diff --git a/.gitignore b/.gitignore index 71fb1375..d2bded2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build/ +.cache/ *.o *.a *.dylib diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/NP2kai.code-workspace b/NP2kai.code-workspace deleted file mode 100644 index 64695695..00000000 --- a/NP2kai.code-workspace +++ /dev/null @@ -1,15 +0,0 @@ -{ - "folders": [ - { - "path": "." - } - ], - "settings": { - "files.associations": { - "dosio.h": "c", - "np2mt.h": "c", - "cpu.h": "c", - "pc9861k.h": "c" - } - } -} \ No newline at end of file diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/accessories/bin2txt.c b/accessories/bin2txt.c old mode 100755 new mode 100644 diff --git a/accessories/lzxpack.c b/accessories/lzxpack.c old mode 100755 new mode 100644 diff --git a/accessories/textout.c b/accessories/textout.c old mode 100755 new mode 100644 diff --git a/accessories/textout.h b/accessories/textout.h old mode 100755 new mode 100644 diff --git a/bios/bios.c b/bios/bios.c old mode 100755 new mode 100644 diff --git a/bios/bios09.c b/bios/bios09.c old mode 100755 new mode 100644 diff --git a/bios/bios0c.c b/bios/bios0c.c old mode 100755 new mode 100644 diff --git a/bios/bios12.c b/bios/bios12.c old mode 100755 new mode 100644 diff --git a/bios/bios13.c b/bios/bios13.c old mode 100755 new mode 100644 diff --git a/bios/bios19.c b/bios/bios19.c old mode 100755 new mode 100644 diff --git a/bios/bios1a.c b/bios/bios1a.c old mode 100755 new mode 100644 diff --git a/bios/bios1b.c b/bios/bios1b.c old mode 100755 new mode 100644 diff --git a/bios/bios1c.c b/bios/bios1c.c old mode 100755 new mode 100644 diff --git a/bios/bios1f.c b/bios/bios1f.c old mode 100755 new mode 100644 diff --git a/bios/biosfd80.res b/bios/biosfd80.res old mode 100755 new mode 100644 diff --git a/bios/biosmem.h b/bios/biosmem.h old mode 100755 new mode 100644 diff --git a/bios/fdfmt.h b/bios/fdfmt.h old mode 100755 new mode 100644 diff --git a/bios/keytable.res b/bios/keytable.res old mode 100755 new mode 100644 diff --git a/bios/rsbios.h b/bios/rsbios.h old mode 100755 new mode 100644 diff --git a/bios/startup.res b/bios/startup.res old mode 100755 new mode 100644 diff --git a/bios/sxsibios.c b/bios/sxsibios.c old mode 100755 new mode 100644 diff --git a/bios/sxsibios.h b/bios/sxsibios.h old mode 100755 new mode 100644 diff --git a/calendar.c b/calendar.c old mode 100755 new mode 100644 diff --git a/calendar.h b/calendar.h old mode 100755 new mode 100644 diff --git a/cbus/amd98.c b/cbus/amd98.c old mode 100755 new mode 100644 diff --git a/cbus/amd98.h b/cbus/amd98.h old mode 100755 new mode 100644 diff --git a/cbus/atapicmd.h b/cbus/atapicmd.h old mode 100755 new mode 100644 diff --git a/cbus/board118.c b/cbus/board118.c old mode 100755 new mode 100644 diff --git a/cbus/board118.h b/cbus/board118.h old mode 100755 new mode 100644 diff --git a/cbus/board14.c b/cbus/board14.c old mode 100755 new mode 100644 diff --git a/cbus/board14.h b/cbus/board14.h old mode 100755 new mode 100644 diff --git a/cbus/board26k.c b/cbus/board26k.c old mode 100755 new mode 100644 diff --git a/cbus/board26k.h b/cbus/board26k.h old mode 100755 new mode 100644 diff --git a/cbus/board86.c b/cbus/board86.c old mode 100755 new mode 100644 diff --git a/cbus/board86.h b/cbus/board86.h old mode 100755 new mode 100644 diff --git a/cbus/boardlol.c b/cbus/boardlol.c old mode 100755 new mode 100644 diff --git a/cbus/boardmo.c b/cbus/boardmo.c old mode 100755 new mode 100644 diff --git a/cbus/boardpx.c b/cbus/boardpx.c old mode 100755 new mode 100644 diff --git a/cbus/boardpx.h b/cbus/boardpx.h old mode 100755 new mode 100644 diff --git a/cbus/boardsb16.c b/cbus/boardsb16.c old mode 100755 new mode 100644 diff --git a/cbus/boardsb16.h b/cbus/boardsb16.h old mode 100755 new mode 100644 diff --git a/cbus/boardso.c b/cbus/boardso.c old mode 100755 new mode 100644 diff --git a/cbus/boardso.h b/cbus/boardso.h old mode 100755 new mode 100644 diff --git a/cbus/boardspb.c b/cbus/boardspb.c old mode 100755 new mode 100644 diff --git a/cbus/boardspb.h b/cbus/boardspb.h old mode 100755 new mode 100644 diff --git a/cbus/boardx2.c b/cbus/boardx2.c old mode 100755 new mode 100644 diff --git a/cbus/boardx2.h b/cbus/boardx2.h old mode 100755 new mode 100644 diff --git a/cbus/cbuscore.c b/cbus/cbuscore.c old mode 100755 new mode 100644 diff --git a/cbus/cbuscore.h b/cbus/cbuscore.h old mode 100755 new mode 100644 diff --git a/cbus/cs4231io.c b/cbus/cs4231io.c old mode 100755 new mode 100644 diff --git a/cbus/cs4231io.h b/cbus/cs4231io.h old mode 100755 new mode 100644 diff --git a/cbus/ct1741io.c b/cbus/ct1741io.c old mode 100755 new mode 100644 diff --git a/cbus/ct1741io.h b/cbus/ct1741io.h old mode 100755 new mode 100644 diff --git a/cbus/ct1745io.c b/cbus/ct1745io.c old mode 100755 new mode 100644 diff --git a/cbus/ct1745io.h b/cbus/ct1745io.h old mode 100755 new mode 100644 diff --git a/cbus/gpibio.c b/cbus/gpibio.c old mode 100755 new mode 100644 diff --git a/cbus/gpibio.h b/cbus/gpibio.h old mode 100755 new mode 100644 diff --git a/cbus/idebios.res b/cbus/idebios.res old mode 100755 new mode 100644 diff --git a/cbus/ideio.c b/cbus/ideio.c old mode 100755 new mode 100644 diff --git a/cbus/ideio.h b/cbus/ideio.h old mode 100755 new mode 100644 diff --git a/cbus/mpu98ii.c b/cbus/mpu98ii.c old mode 100755 new mode 100644 diff --git a/cbus/mpu98ii.h b/cbus/mpu98ii.h old mode 100755 new mode 100644 diff --git a/cbus/pc9861k.c b/cbus/pc9861k.c old mode 100755 new mode 100644 diff --git a/cbus/pc9861k.h b/cbus/pc9861k.h old mode 100755 new mode 100644 diff --git a/cbus/pcm86io.c b/cbus/pcm86io.c old mode 100755 new mode 100644 diff --git a/cbus/pcm86io.h b/cbus/pcm86io.h old mode 100755 new mode 100644 diff --git a/cbus/sasibios.res b/cbus/sasibios.res old mode 100755 new mode 100644 diff --git a/cbus/sasiio.c b/cbus/sasiio.c old mode 100755 new mode 100644 diff --git a/cbus/sasiio.h b/cbus/sasiio.h old mode 100755 new mode 100644 diff --git a/cbus/scsibios.res b/cbus/scsibios.res old mode 100755 new mode 100644 diff --git a/cbus/scsicmd.c b/cbus/scsicmd.c old mode 100755 new mode 100644 diff --git a/cbus/scsicmd.h b/cbus/scsicmd.h old mode 100755 new mode 100644 diff --git a/cbus/scsiio.c b/cbus/scsiio.c old mode 100755 new mode 100644 diff --git a/cbus/scsiio.h b/cbus/scsiio.h old mode 100755 new mode 100644 diff --git a/cbus/scsiio.tbl b/cbus/scsiio.tbl old mode 100755 new mode 100644 diff --git a/codecnv/codecnv.h b/codecnv/codecnv.h old mode 100755 new mode 100644 diff --git a/codecnv/eucsjis.c b/codecnv/eucsjis.c old mode 100755 new mode 100644 diff --git a/codecnv/eucucs2.c b/codecnv/eucucs2.c old mode 100755 new mode 100644 diff --git a/codecnv/sjiseuc.c b/codecnv/sjiseuc.c old mode 100755 new mode 100644 diff --git a/codecnv/sjisucs2.c b/codecnv/sjisucs2.c old mode 100755 new mode 100644 diff --git a/codecnv/tcswap16.c b/codecnv/tcswap16.c old mode 100755 new mode 100644 diff --git a/codecnv/tcswap32.c b/codecnv/tcswap32.c old mode 100755 new mode 100644 diff --git a/codecnv/textcnv.c b/codecnv/textcnv.c old mode 100755 new mode 100644 diff --git a/codecnv/textcnv.h b/codecnv/textcnv.h old mode 100755 new mode 100644 diff --git a/codecnv/ucs2sjis.c b/codecnv/ucs2sjis.c old mode 100755 new mode 100644 diff --git a/codecnv/ucs2ucs4.c b/codecnv/ucs2ucs4.c old mode 100755 new mode 100644 diff --git a/codecnv/ucs2utf8.c b/codecnv/ucs2utf8.c old mode 100755 new mode 100644 diff --git a/codecnv/utf8ucs2.c b/codecnv/utf8ucs2.c old mode 100755 new mode 100644 diff --git a/codecnv/utf8ucs4.c b/codecnv/utf8ucs4.c old mode 100755 new mode 100644 diff --git a/common.h b/common.h old mode 100755 new mode 100644 diff --git a/common/_memory.c b/common/_memory.c old mode 100755 new mode 100644 diff --git a/common/_memory.h b/common/_memory.h old mode 100755 new mode 100644 diff --git a/common/bmpdata.c b/common/bmpdata.c old mode 100755 new mode 100644 diff --git a/common/bmpdata.h b/common/bmpdata.h old mode 100755 new mode 100644 diff --git a/common/lstarray.c b/common/lstarray.c old mode 100755 new mode 100644 diff --git a/common/lstarray.h b/common/lstarray.h old mode 100755 new mode 100644 diff --git a/common/milstr.c b/common/milstr.c old mode 100755 new mode 100644 diff --git a/common/milstr.h b/common/milstr.h old mode 100755 new mode 100644 diff --git a/common/mimpidef.c b/common/mimpidef.c old mode 100755 new mode 100644 diff --git a/common/mimpidef.h b/common/mimpidef.h old mode 100755 new mode 100644 diff --git a/common/parts.c b/common/parts.c old mode 100755 new mode 100644 diff --git a/common/parts.h b/common/parts.h old mode 100755 new mode 100644 diff --git a/common/profile.c b/common/profile.c old mode 100755 new mode 100644 diff --git a/common/profile.h b/common/profile.h old mode 100755 new mode 100644 diff --git a/common/rect.c b/common/rect.c old mode 100755 new mode 100644 diff --git a/common/rect.h b/common/rect.h old mode 100755 new mode 100644 diff --git a/common/resize.c b/common/resize.c old mode 100755 new mode 100644 diff --git a/common/resize.h b/common/resize.h old mode 100755 new mode 100644 diff --git a/common/strres.c b/common/strres.c old mode 100755 new mode 100644 diff --git a/common/strres.h b/common/strres.h old mode 100755 new mode 100644 diff --git a/common/textfile.c b/common/textfile.c old mode 100755 new mode 100644 diff --git a/common/textfile.h b/common/textfile.h old mode 100755 new mode 100644 diff --git a/common/wavefile.c b/common/wavefile.c old mode 100755 new mode 100644 diff --git a/common/wavefile.h b/common/wavefile.h old mode 100755 new mode 100644 diff --git a/debugsnapshot.c b/debugsnapshot.c old mode 100755 new mode 100644 diff --git a/debugsnapshot.h b/debugsnapshot.h old mode 100755 new mode 100644 diff --git a/debugsub.c b/debugsub.c old mode 100755 new mode 100644 diff --git a/debugsub.h b/debugsub.h old mode 100755 new mode 100644 diff --git a/debugsub386.c b/debugsub386.c old mode 100755 new mode 100644 diff --git a/diskimage/cd/cdd_ccd.c b/diskimage/cd/cdd_ccd.c old mode 100755 new mode 100644 diff --git a/diskimage/cd/cdd_ccd.h b/diskimage/cd/cdd_ccd.h old mode 100755 new mode 100644 diff --git a/diskimage/cd/cdd_cue.c b/diskimage/cd/cdd_cue.c old mode 100755 new mode 100644 diff --git a/diskimage/cd/cdd_cue.h b/diskimage/cd/cdd_cue.h old mode 100755 new mode 100644 diff --git a/diskimage/cd/cdd_iso.c b/diskimage/cd/cdd_iso.c old mode 100755 new mode 100644 diff --git a/diskimage/cd/cdd_iso.h b/diskimage/cd/cdd_iso.h old mode 100755 new mode 100644 diff --git a/diskimage/cd/cdd_mds.c b/diskimage/cd/cdd_mds.c old mode 100755 new mode 100644 diff --git a/diskimage/cd/cdd_mds.h b/diskimage/cd/cdd_mds.h old mode 100755 new mode 100644 diff --git a/diskimage/cd/cdd_nrg.c b/diskimage/cd/cdd_nrg.c old mode 100755 new mode 100644 diff --git a/diskimage/cd/cdd_nrg.h b/diskimage/cd/cdd_nrg.h old mode 100755 new mode 100644 diff --git a/diskimage/cd/cdd_real.c b/diskimage/cd/cdd_real.c old mode 100755 new mode 100644 diff --git a/diskimage/cddfile.c b/diskimage/cddfile.c old mode 100755 new mode 100644 diff --git a/diskimage/cddfile.h b/diskimage/cddfile.h old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_bkdsk.c b/diskimage/fd/fdd_bkdsk.c old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_bkdsk.h b/diskimage/fd/fdd_bkdsk.h old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_d88.c b/diskimage/fd/fdd_d88.c old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_d88.h b/diskimage/fd/fdd_d88.h old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_dcp.c b/diskimage/fd/fdd_dcp.c old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_dcp.h b/diskimage/fd/fdd_dcp.h old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_head_d88.h b/diskimage/fd/fdd_head_d88.h old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_head_dcp.h b/diskimage/fd/fdd_head_dcp.h old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_head_nfd.h b/diskimage/fd/fdd_head_nfd.h old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_head_vfdd.h b/diskimage/fd/fdd_head_vfdd.h old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_nfd.c b/diskimage/fd/fdd_nfd.c old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_nfd.h b/diskimage/fd/fdd_nfd.h old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_vfdd.c b/diskimage/fd/fdd_vfdd.c old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_vfdd.h b/diskimage/fd/fdd_vfdd.h old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_xdf.c b/diskimage/fd/fdd_xdf.c old mode 100755 new mode 100644 diff --git a/diskimage/fd/fdd_xdf.h b/diskimage/fd/fdd_xdf.h old mode 100755 new mode 100644 diff --git a/diskimage/fddfile.c b/diskimage/fddfile.c old mode 100755 new mode 100644 diff --git a/diskimage/fddfile.h b/diskimage/fddfile.h old mode 100755 new mode 100644 diff --git a/diskimage/img_common.h b/diskimage/img_common.h old mode 100755 new mode 100644 diff --git a/diskimage/img_strres.c b/diskimage/img_strres.c old mode 100755 new mode 100644 diff --git a/diskimage/img_strres.h b/diskimage/img_strres.h old mode 100755 new mode 100644 diff --git a/diskimage/win9x/img_dosio.c b/diskimage/win9x/img_dosio.c old mode 100755 new mode 100644 diff --git a/diskimage/win9x/img_dosio.h b/diskimage/win9x/img_dosio.h old mode 100755 new mode 100644 diff --git a/embed/menu/dlgabout.c b/embed/menu/dlgabout.c old mode 100755 new mode 100644 diff --git a/embed/menu/dlgabout.h b/embed/menu/dlgabout.h old mode 100755 new mode 100644 diff --git a/embed/menu/dlgcfg.c b/embed/menu/dlgcfg.c old mode 100755 new mode 100644 diff --git a/embed/menu/dlgcfg.h b/embed/menu/dlgcfg.h old mode 100755 new mode 100644 diff --git a/embed/menu/dlgscr.c b/embed/menu/dlgscr.c old mode 100755 new mode 100644 diff --git a/embed/menu/dlgscr.h b/embed/menu/dlgscr.h old mode 100755 new mode 100644 diff --git a/embed/menu/dlgwab.c b/embed/menu/dlgwab.c old mode 100755 new mode 100644 diff --git a/embed/menu/dlgwab.h b/embed/menu/dlgwab.h old mode 100755 new mode 100644 diff --git a/embed/menu/filesel.c b/embed/menu/filesel.c old mode 100755 new mode 100644 diff --git a/embed/menu/filesel.h b/embed/menu/filesel.h old mode 100755 new mode 100644 diff --git a/embed/menu/menustr.c b/embed/menu/menustr.c old mode 100755 new mode 100644 diff --git a/embed/menu/menustr.h b/embed/menu/menustr.h old mode 100755 new mode 100644 diff --git a/embed/menubase/menubase.c b/embed/menubase/menubase.c old mode 100755 new mode 100644 diff --git a/embed/menubase/menubase.h b/embed/menubase/menubase.h old mode 100755 new mode 100644 diff --git a/embed/menubase/menudeco.inc b/embed/menubase/menudeco.inc old mode 100755 new mode 100644 diff --git a/embed/menubase/menudlg.c b/embed/menubase/menudlg.c old mode 100755 new mode 100644 diff --git a/embed/menubase/menudlg.h b/embed/menubase/menudlg.h old mode 100755 new mode 100644 diff --git a/embed/menubase/menuicon.c b/embed/menubase/menuicon.c old mode 100755 new mode 100644 diff --git a/embed/menubase/menuicon.h b/embed/menubase/menuicon.h old mode 100755 new mode 100644 diff --git a/embed/menubase/menumbox.c b/embed/menubase/menumbox.c old mode 100755 new mode 100644 diff --git a/embed/menubase/menumbox.h b/embed/menubase/menumbox.h old mode 100755 new mode 100644 diff --git a/embed/menubase/menures.c b/embed/menubase/menures.c old mode 100755 new mode 100644 diff --git a/embed/menubase/menures.h b/embed/menubase/menures.h old mode 100755 new mode 100644 diff --git a/embed/menubase/menusys.c b/embed/menubase/menusys.c old mode 100755 new mode 100644 diff --git a/embed/menubase/menusys.h b/embed/menubase/menusys.h old mode 100755 new mode 100644 diff --git a/embed/menubase/menuvram.c b/embed/menubase/menuvram.c old mode 100755 new mode 100644 diff --git a/embed/menubase/menuvram.h b/embed/menubase/menuvram.h old mode 100755 new mode 100644 diff --git a/embed/readme.txt b/embed/readme.txt old mode 100755 new mode 100644 diff --git a/embed/vramhdl.c b/embed/vramhdl.c old mode 100755 new mode 100644 diff --git a/embed/vramhdl.h b/embed/vramhdl.h old mode 100755 new mode 100644 diff --git a/embed/vrammix.c b/embed/vrammix.c old mode 100755 new mode 100644 diff --git a/embed/vrammix.h b/embed/vrammix.h old mode 100755 new mode 100644 diff --git a/fdd/d88head.h b/fdd/d88head.h old mode 100755 new mode 100644 diff --git a/fdd/diskdrv.c b/fdd/diskdrv.c old mode 100755 new mode 100644 diff --git a/fdd/diskdrv.h b/fdd/diskdrv.h old mode 100755 new mode 100644 diff --git a/fdd/fdd_mtr.c b/fdd/fdd_mtr.c old mode 100755 new mode 100644 diff --git a/fdd/fdd_mtr.h b/fdd/fdd_mtr.h old mode 100755 new mode 100644 diff --git a/fdd/fdd_mtr.res b/fdd/fdd_mtr.res old mode 100755 new mode 100644 diff --git a/fdd/hdd_vhd.h b/fdd/hdd_vhd.h old mode 100755 new mode 100644 diff --git a/fdd/hdd_vpc.h b/fdd/hdd_vpc.h old mode 100755 new mode 100644 diff --git a/fdd/hddboot.res b/fdd/hddboot.res old mode 100755 new mode 100644 diff --git a/fdd/newdisk.c b/fdd/newdisk.c old mode 100755 new mode 100644 diff --git a/fdd/newdisk.h b/fdd/newdisk.h old mode 100755 new mode 100644 diff --git a/fdd/sxsi.c b/fdd/sxsi.c old mode 100755 new mode 100644 diff --git a/fdd/sxsi.h b/fdd/sxsi.h old mode 100755 new mode 100644 diff --git a/fdd/sxsicd.c b/fdd/sxsicd.c old mode 100755 new mode 100644 diff --git a/fdd/sxsicd.h b/fdd/sxsicd.h old mode 100755 new mode 100644 diff --git a/fdd/sxsihdd.c b/fdd/sxsihdd.c old mode 100755 new mode 100644 diff --git a/fdd/sxsihdd.h b/fdd/sxsihdd.h old mode 100755 new mode 100644 diff --git a/fdd/sxsihdd_nvl.c b/fdd/sxsihdd_nvl.c old mode 100755 new mode 100644 diff --git a/font/font.c b/font/font.c old mode 100755 new mode 100644 diff --git a/font/font.h b/font/font.h old mode 100755 new mode 100644 diff --git a/font/fontdata.c b/font/fontdata.c old mode 100755 new mode 100644 diff --git a/font/fontdata.h b/font/fontdata.h old mode 100755 new mode 100644 diff --git a/font/fontdata.res b/font/fontdata.res old mode 100755 new mode 100644 diff --git a/font/fontfm7.c b/font/fontfm7.c old mode 100755 new mode 100644 diff --git a/font/fontmake.c b/font/fontmake.c old mode 100755 new mode 100644 diff --git a/font/fontmake.h b/font/fontmake.h old mode 100755 new mode 100644 diff --git a/font/fontpc88.c b/font/fontpc88.c old mode 100755 new mode 100644 diff --git a/font/fontpc98.c b/font/fontpc98.c old mode 100755 new mode 100644 diff --git a/font/fontv98.c b/font/fontv98.c old mode 100755 new mode 100644 diff --git a/font/fontx1.c b/font/fontx1.c old mode 100755 new mode 100644 diff --git a/font/fontx68k.c b/font/fontx68k.c old mode 100755 new mode 100644 diff --git a/font/readme.txt b/font/readme.txt old mode 100755 new mode 100644 diff --git a/generic/cmjasts.c b/generic/cmjasts.c old mode 100755 new mode 100644 diff --git a/generic/cmjasts.h b/generic/cmjasts.h old mode 100755 new mode 100644 diff --git a/generic/cmndraw.c b/generic/cmndraw.c old mode 100755 new mode 100644 diff --git a/generic/cmndraw.h b/generic/cmndraw.h old mode 100755 new mode 100644 diff --git a/generic/cmver.c b/generic/cmver.c old mode 100755 new mode 100644 diff --git a/generic/cmver.h b/generic/cmver.h old mode 100755 new mode 100644 diff --git a/generic/dipswbmp.c b/generic/dipswbmp.c old mode 100755 new mode 100644 diff --git a/generic/dipswbmp.h b/generic/dipswbmp.h old mode 100755 new mode 100644 diff --git a/generic/dipswbmp.res b/generic/dipswbmp.res old mode 100755 new mode 100644 diff --git a/generic/hostdrv.c b/generic/hostdrv.c old mode 100755 new mode 100644 diff --git a/generic/hostdrv.h b/generic/hostdrv.h old mode 100755 new mode 100644 diff --git a/generic/hostdrv.tbl b/generic/hostdrv.tbl old mode 100755 new mode 100644 diff --git a/generic/hostdrvs.c b/generic/hostdrvs.c old mode 100755 new mode 100644 diff --git a/generic/hostdrvs.h b/generic/hostdrvs.h old mode 100755 new mode 100644 diff --git a/generic/keydisp.c b/generic/keydisp.c old mode 100755 new mode 100644 diff --git a/generic/keydisp.h b/generic/keydisp.h old mode 100755 new mode 100644 diff --git a/generic/keydisp.res b/generic/keydisp.res old mode 100755 new mode 100644 diff --git a/generic/memdbg32.c b/generic/memdbg32.c old mode 100755 new mode 100644 diff --git a/generic/memdbg32.h b/generic/memdbg32.h old mode 100755 new mode 100644 diff --git a/generic/minifont.res b/generic/minifont.res old mode 100755 new mode 100644 diff --git a/generic/np2info.c b/generic/np2info.c old mode 100755 new mode 100644 diff --git a/generic/np2info.h b/generic/np2info.h old mode 100755 new mode 100644 diff --git a/generic/readme.txt b/generic/readme.txt old mode 100755 new mode 100644 diff --git a/generic/softkbd.c b/generic/softkbd.c old mode 100755 new mode 100644 diff --git a/generic/softkbd.h b/generic/softkbd.h old mode 100755 new mode 100644 diff --git a/generic/softkbd.res b/generic/softkbd.res old mode 100755 new mode 100644 diff --git a/generic/softkbd1.res b/generic/softkbd1.res old mode 100755 new mode 100644 diff --git a/generic/softkbd2.res b/generic/softkbd2.res old mode 100755 new mode 100644 diff --git a/generic/softkbd3.res b/generic/softkbd3.res old mode 100755 new mode 100644 diff --git a/generic/unasm.c b/generic/unasm.c old mode 100755 new mode 100644 diff --git a/generic/unasm.h b/generic/unasm.h old mode 100755 new mode 100644 diff --git a/generic/unasmdef.tbl b/generic/unasmdef.tbl old mode 100755 new mode 100644 diff --git a/generic/unasmfpu.tbl b/generic/unasmfpu.tbl old mode 100755 new mode 100644 diff --git a/generic/unasmop.tbl b/generic/unasmop.tbl old mode 100755 new mode 100644 diff --git a/generic/unasmop3.tbl b/generic/unasmop3.tbl old mode 100755 new mode 100644 diff --git a/generic/unasmop8.tbl b/generic/unasmop8.tbl old mode 100755 new mode 100644 diff --git a/generic/unasmstr.tbl b/generic/unasmstr.tbl old mode 100755 new mode 100644 diff --git a/i286c/cpucore.h b/i286c/cpucore.h old mode 100755 new mode 100644 diff --git a/i286c/cpumem.c b/i286c/cpumem.c old mode 100755 new mode 100644 diff --git a/i286c/cpumem.h b/i286c/cpumem.h old mode 100755 new mode 100644 diff --git a/i286c/i286c.c b/i286c/i286c.c old mode 100755 new mode 100644 diff --git a/i286c/i286c.h b/i286c/i286c.h old mode 100755 new mode 100644 diff --git a/i286c/i286c.mcr b/i286c/i286c.mcr old mode 100755 new mode 100644 diff --git a/i286c/i286c_0f.c b/i286c/i286c_0f.c old mode 100755 new mode 100644 diff --git a/i286c/i286c_8x.c b/i286c/i286c_8x.c old mode 100755 new mode 100644 diff --git a/i286c/i286c_ea.c b/i286c/i286c_ea.c old mode 100755 new mode 100644 diff --git a/i286c/i286c_f6.c b/i286c/i286c_f6.c old mode 100755 new mode 100644 diff --git a/i286c/i286c_fe.c b/i286c/i286c_fe.c old mode 100755 new mode 100644 diff --git a/i286c/i286c_mn.c b/i286c/i286c_mn.c old mode 100755 new mode 100644 diff --git a/i286c/i286c_rp.c b/i286c/i286c_rp.c old mode 100755 new mode 100644 diff --git a/i286c/i286c_sf.c b/i286c/i286c_sf.c old mode 100755 new mode 100644 diff --git a/i286c/i286c_sf.mcr b/i286c/i286c_sf.mcr old mode 100755 new mode 100644 diff --git a/i286c/v30patch.c b/i286c/v30patch.c old mode 100755 new mode 100644 diff --git a/i286c/v30patch.h b/i286c/v30patch.h old mode 100755 new mode 100644 diff --git a/i286x/cpucore.h b/i286x/cpucore.h old mode 100755 new mode 100644 diff --git a/i286x/cpucore.inc b/i286x/cpucore.inc old mode 100755 new mode 100644 diff --git a/i286x/cpumem.h b/i286x/cpumem.h old mode 100755 new mode 100644 diff --git a/i286x/cpumem.x86 b/i286x/cpumem.x86 old mode 100755 new mode 100644 diff --git a/i286x/dmap.h b/i286x/dmap.h old mode 100755 new mode 100644 diff --git a/i286x/dmap.x86 b/i286x/dmap.x86 old mode 100755 new mode 100644 diff --git a/i286x/i286x.cpp b/i286x/i286x.cpp old mode 100755 new mode 100644 diff --git a/i286x/i286x.h b/i286x/i286x.h old mode 100755 new mode 100644 diff --git a/i286x/i286x.mcr b/i286x/i286x.mcr old mode 100755 new mode 100644 diff --git a/i286x/i286xadr.cpp b/i286x/i286xadr.cpp old mode 100755 new mode 100644 diff --git a/i286x/i286xadr.h b/i286x/i286xadr.h old mode 100755 new mode 100644 diff --git a/i286x/i286xcts.cpp b/i286x/i286xcts.cpp old mode 100755 new mode 100644 diff --git a/i286x/i286xcts.h b/i286x/i286xcts.h old mode 100755 new mode 100644 diff --git a/i286x/i286xea.mcr b/i286x/i286xea.mcr old mode 100755 new mode 100644 diff --git a/i286x/i286xrep.cpp b/i286x/i286xrep.cpp old mode 100755 new mode 100644 diff --git a/i286x/i286xrep.h b/i286x/i286xrep.h old mode 100755 new mode 100644 diff --git a/i286x/i286xs.cpp b/i286x/i286xs.cpp old mode 100755 new mode 100644 diff --git a/i286x/i286xs.h b/i286x/i286xs.h old mode 100755 new mode 100644 diff --git a/i286x/v30patch.cpp b/i286x/v30patch.cpp old mode 100755 new mode 100644 diff --git a/i286x/v30patch.h b/i286x/v30patch.h old mode 100755 new mode 100644 diff --git a/i386c/cpucore.c b/i386c/cpucore.c old mode 100755 new mode 100644 diff --git a/i386c/cpucore.h b/i386c/cpucore.h old mode 100755 new mode 100644 diff --git a/i386c/cpumem.c b/i386c/cpumem.c old mode 100755 new mode 100644 diff --git a/i386c/cpumem.h b/i386c/cpumem.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/cpu.c b/i386c/ia32/cpu.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/cpu.h b/i386c/ia32/cpu.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/cpu_io.c b/i386c/ia32/cpu_io.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/cpu_io.h b/i386c/ia32/cpu_io.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/cpu_mem.c b/i386c/ia32/cpu_mem.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/cpu_mem.h b/i386c/ia32/cpu_mem.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/cpu_mem.mcr b/i386c/ia32/cpu_mem.mcr old mode 100755 new mode 100644 diff --git a/i386c/ia32/ctrlxfer.c b/i386c/ia32/ctrlxfer.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/ctrlxfer.h b/i386c/ia32/ctrlxfer.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/debug.c b/i386c/ia32/debug.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/disasm.c b/i386c/ia32/disasm.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/exception.c b/i386c/ia32/exception.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/exception.h b/i386c/ia32/exception.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/groups.c b/i386c/ia32/groups.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/groups.h b/i386c/ia32/groups.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/ia32.c b/i386c/ia32/ia32.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/ia32.mcr b/i386c/ia32/ia32.mcr old mode 100755 new mode 100644 diff --git a/i386c/ia32/ia32weak.txt b/i386c/ia32/ia32weak.txt old mode 100755 new mode 100644 diff --git a/i386c/ia32/ia32xc.mcr b/i386c/ia32/ia32xc.mcr old mode 100755 new mode 100644 diff --git a/i386c/ia32/ia32xc_msc.mcr b/i386c/ia32/ia32xc_msc.mcr old mode 100755 new mode 100644 diff --git a/i386c/ia32/inst_table.c b/i386c/ia32/inst_table.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/inst_table.h b/i386c/ia32/inst_table.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/arith.mcr b/i386c/ia32/instructions/arith.mcr old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/bin_arith.c b/i386c/ia32/instructions/bin_arith.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/bin_arith.h b/i386c/ia32/instructions/bin_arith.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/bit_byte.c b/i386c/ia32/instructions/bit_byte.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/bit_byte.h b/i386c/ia32/instructions/bit_byte.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/ctrl_trans.c b/i386c/ia32/instructions/ctrl_trans.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/ctrl_trans.h b/i386c/ia32/instructions/ctrl_trans.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/data_trans.c b/i386c/ia32/instructions/data_trans.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/data_trans.h b/i386c/ia32/instructions/data_trans.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/dec_arith.c b/i386c/ia32/instructions/dec_arith.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/dec_arith.h b/i386c/ia32/instructions/dec_arith.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/flag_ctrl.c b/i386c/ia32/instructions/flag_ctrl.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/flag_ctrl.h b/i386c/ia32/instructions/flag_ctrl.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/fpu.c b/i386c/ia32/instructions/fpu.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/fpu/fp.h b/i386c/ia32/instructions/fpu/fp.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/fpu/fpdummy.c b/i386c/ia32/instructions/fpu/fpdummy.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/fpu/fpemul.c b/i386c/ia32/instructions/fpu/fpemul.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/fpu/fpemul_dosbox.c b/i386c/ia32/instructions/fpu/fpemul_dosbox.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/fpu/fpemul_dosbox2.c b/i386c/ia32/instructions/fpu/fpemul_dosbox2.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/fpu/fpemul_softfloat.c b/i386c/ia32/instructions/fpu/fpemul_softfloat.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/fpu/fpumem.h b/i386c/ia32/instructions/fpu/fpumem.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/logic_arith.c b/i386c/ia32/instructions/logic_arith.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/logic_arith.h b/i386c/ia32/instructions/logic_arith.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/misc_inst.c b/i386c/ia32/instructions/misc_inst.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/misc_inst.h b/i386c/ia32/instructions/misc_inst.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/mmx/3dnow.c b/i386c/ia32/instructions/mmx/3dnow.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/mmx/3dnow.h b/i386c/ia32/instructions/mmx/3dnow.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/mmx/mmx.c b/i386c/ia32/instructions/mmx/mmx.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/mmx/mmx.h b/i386c/ia32/instructions/mmx/mmx.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/mmx/mmx2.txt b/i386c/ia32/instructions/mmx/mmx2.txt old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/seg_reg.c b/i386c/ia32/instructions/seg_reg.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/seg_reg.h b/i386c/ia32/instructions/seg_reg.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/shift_rotate.c b/i386c/ia32/instructions/shift_rotate.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/shift_rotate.h b/i386c/ia32/instructions/shift_rotate.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/shift_rotate.mcr b/i386c/ia32/instructions/shift_rotate.mcr old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/shift_rotatexc.mcr b/i386c/ia32/instructions/shift_rotatexc.mcr old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/shift_rotatexc_msc.mcr b/i386c/ia32/instructions/shift_rotatexc_msc.mcr old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/sse/sse.c b/i386c/ia32/instructions/sse/sse.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/sse/sse.h b/i386c/ia32/instructions/sse/sse.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/sse2/sse2.h b/i386c/ia32/instructions/sse2/sse2.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/sse3/sse3.c b/i386c/ia32/instructions/sse3/sse3.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/sse3/sse3.h b/i386c/ia32/instructions/sse3/sse3.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/string_inst.c b/i386c/ia32/instructions/string_inst.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/string_inst.h b/i386c/ia32/instructions/string_inst.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/system_inst.c b/i386c/ia32/instructions/system_inst.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/instructions/system_inst.h b/i386c/ia32/instructions/system_inst.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/interface.c b/i386c/ia32/interface.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/interface.h b/i386c/ia32/interface.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/paging.c b/i386c/ia32/paging.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/paging.h b/i386c/ia32/paging.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/resolve.c b/i386c/ia32/resolve.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/resolve.h b/i386c/ia32/resolve.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/segments.c b/i386c/ia32/segments.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/segments.h b/i386c/ia32/segments.h old mode 100755 new mode 100644 diff --git a/i386c/ia32/task.c b/i386c/ia32/task.c old mode 100755 new mode 100644 diff --git a/i386c/ia32/task.h b/i386c/ia32/task.h old mode 100755 new mode 100644 diff --git a/io/artic.c b/io/artic.c old mode 100755 new mode 100644 diff --git a/io/artic.h b/io/artic.h old mode 100755 new mode 100644 diff --git a/io/bmsio.c b/io/bmsio.c old mode 100755 new mode 100644 diff --git a/io/bmsio.h b/io/bmsio.h old mode 100755 new mode 100644 diff --git a/io/cgrom.c b/io/cgrom.c old mode 100755 new mode 100644 diff --git a/io/cgrom.h b/io/cgrom.h old mode 100755 new mode 100644 diff --git a/io/cpuio.c b/io/cpuio.c old mode 100755 new mode 100644 diff --git a/io/cpuio.h b/io/cpuio.h old mode 100755 new mode 100644 diff --git a/io/crtc.c b/io/crtc.c old mode 100755 new mode 100644 diff --git a/io/crtc.h b/io/crtc.h old mode 100755 new mode 100644 diff --git a/io/dipsw.c b/io/dipsw.c old mode 100755 new mode 100644 diff --git a/io/dipsw.h b/io/dipsw.h old mode 100755 new mode 100644 diff --git a/io/dmac.c b/io/dmac.c old mode 100755 new mode 100644 diff --git a/io/dmac.h b/io/dmac.h old mode 100755 new mode 100644 diff --git a/io/egc.c b/io/egc.c old mode 100755 new mode 100644 diff --git a/io/egc.h b/io/egc.h old mode 100755 new mode 100644 diff --git a/io/emsio.c b/io/emsio.c old mode 100755 new mode 100644 diff --git a/io/emsio.h b/io/emsio.h old mode 100755 new mode 100644 diff --git a/io/epsonio.c b/io/epsonio.c old mode 100755 new mode 100644 diff --git a/io/epsonio.h b/io/epsonio.h old mode 100755 new mode 100644 diff --git a/io/fdc.c b/io/fdc.c old mode 100755 new mode 100644 diff --git a/io/fdc.h b/io/fdc.h old mode 100755 new mode 100644 diff --git a/io/fdd320.c b/io/fdd320.c old mode 100755 new mode 100644 diff --git a/io/fdd320.h b/io/fdd320.h old mode 100755 new mode 100644 diff --git a/io/gdc.c b/io/gdc.c old mode 100755 new mode 100644 diff --git a/io/gdc.h b/io/gdc.h old mode 100755 new mode 100644 diff --git a/io/gdc_cmd.h b/io/gdc_cmd.h old mode 100755 new mode 100644 diff --git a/io/gdc_cmd.tbl b/io/gdc_cmd.tbl old mode 100755 new mode 100644 diff --git a/io/gdc_pset.c b/io/gdc_pset.c old mode 100755 new mode 100644 diff --git a/io/gdc_pset.h b/io/gdc_pset.h old mode 100755 new mode 100644 diff --git a/io/gdc_sub.c b/io/gdc_sub.c old mode 100755 new mode 100644 diff --git a/io/gdc_sub.h b/io/gdc_sub.h old mode 100755 new mode 100644 diff --git a/io/iocore.c b/io/iocore.c old mode 100755 new mode 100644 diff --git a/io/iocore.h b/io/iocore.h old mode 100755 new mode 100644 diff --git a/io/iocore16.tbl b/io/iocore16.tbl old mode 100755 new mode 100644 diff --git a/io/lsidef.h b/io/lsidef.h old mode 100755 new mode 100644 diff --git a/io/mouseif.c b/io/mouseif.c old mode 100755 new mode 100644 diff --git a/io/mouseif.h b/io/mouseif.h old mode 100755 new mode 100644 diff --git a/io/necio.c b/io/necio.c old mode 100755 new mode 100644 diff --git a/io/necio.h b/io/necio.h old mode 100755 new mode 100644 diff --git a/io/nmiio.c b/io/nmiio.c old mode 100755 new mode 100644 diff --git a/io/nmiio.h b/io/nmiio.h old mode 100755 new mode 100644 diff --git a/io/np2sysp.c b/io/np2sysp.c old mode 100755 new mode 100644 diff --git a/io/np2sysp.h b/io/np2sysp.h old mode 100755 new mode 100644 diff --git a/io/pci/98graphbridge.c b/io/pci/98graphbridge.c old mode 100755 new mode 100644 diff --git a/io/pci/98graphbridge.h b/io/pci/98graphbridge.h old mode 100755 new mode 100644 diff --git a/io/pci/cbusbridge.c b/io/pci/cbusbridge.c old mode 100755 new mode 100644 diff --git a/io/pci/cbusbridge.h b/io/pci/cbusbridge.h old mode 100755 new mode 100644 diff --git a/io/pcidev.c b/io/pcidev.c old mode 100755 new mode 100644 diff --git a/io/pcidev.h b/io/pcidev.h old mode 100755 new mode 100644 diff --git a/io/pegc.c b/io/pegc.c old mode 100755 new mode 100644 diff --git a/io/pegc.h b/io/pegc.h old mode 100755 new mode 100644 diff --git a/io/pic.c b/io/pic.c old mode 100755 new mode 100644 diff --git a/io/pic.h b/io/pic.h old mode 100755 new mode 100644 diff --git a/io/pit.c b/io/pit.c old mode 100755 new mode 100644 diff --git a/io/pit.h b/io/pit.h old mode 100755 new mode 100644 diff --git a/io/printif.c b/io/printif.c old mode 100755 new mode 100644 diff --git a/io/printif.h b/io/printif.h old mode 100755 new mode 100644 diff --git a/io/serial.h b/io/serial.h old mode 100755 new mode 100644 diff --git a/io/sysport.c b/io/sysport.c old mode 100755 new mode 100644 diff --git a/io/sysport.h b/io/sysport.h old mode 100755 new mode 100644 diff --git a/io/upd4990.c b/io/upd4990.c old mode 100755 new mode 100644 diff --git a/io/upd4990.h b/io/upd4990.h old mode 100755 new mode 100644 diff --git a/jni/Android.mk b/jni/Android.mk old mode 100755 new mode 100644 diff --git a/jni/Application.mk b/jni/Application.mk old mode 100755 new mode 100644 diff --git a/kai_note.txt b/kai_note.txt old mode 100755 new mode 100644 diff --git a/keystat.c b/keystat.c old mode 100755 new mode 100644 diff --git a/keystat.h b/keystat.h old mode 100755 new mode 100644 diff --git a/keystat.tbl b/keystat.tbl old mode 100755 new mode 100644 diff --git a/lio/gcircle.c b/lio/gcircle.c old mode 100755 new mode 100644 diff --git a/lio/gline.c b/lio/gline.c old mode 100755 new mode 100644 diff --git a/lio/gpset.c b/lio/gpset.c old mode 100755 new mode 100644 diff --git a/lio/gput1.c b/lio/gput1.c old mode 100755 new mode 100644 diff --git a/lio/gscreen.c b/lio/gscreen.c old mode 100755 new mode 100644 diff --git a/lio/lio.c b/lio/lio.c old mode 100755 new mode 100644 diff --git a/lio/lio.h b/lio/lio.h old mode 100755 new mode 100644 diff --git a/lio/lio.res b/lio/lio.res old mode 100755 new mode 100644 diff --git a/mem/dmav30.c b/mem/dmav30.c old mode 100755 new mode 100644 diff --git a/mem/dmav30.h b/mem/dmav30.h old mode 100755 new mode 100644 diff --git a/mem/dmax86.c b/mem/dmax86.c old mode 100755 new mode 100644 diff --git a/mem/dmax86.h b/mem/dmax86.h old mode 100755 new mode 100644 diff --git a/mem/memegc.c b/mem/memegc.c old mode 100755 new mode 100644 diff --git a/mem/memegc.h b/mem/memegc.h old mode 100755 new mode 100644 diff --git a/mem/memems.c b/mem/memems.c old mode 100755 new mode 100644 diff --git a/mem/memems.h b/mem/memems.h old mode 100755 new mode 100644 diff --git a/mem/memepp.c b/mem/memepp.c old mode 100755 new mode 100644 diff --git a/mem/memepp.h b/mem/memepp.h old mode 100755 new mode 100644 diff --git a/mem/memtram.c b/mem/memtram.c old mode 100755 new mode 100644 diff --git a/mem/memtram.h b/mem/memtram.h old mode 100755 new mode 100644 diff --git a/mem/memvga.c b/mem/memvga.c old mode 100755 new mode 100644 diff --git a/mem/memvga.h b/mem/memvga.h old mode 100755 new mode 100644 diff --git a/mem/memvram.c b/mem/memvram.c old mode 100755 new mode 100644 diff --git a/mem/memvram.h b/mem/memvram.h old mode 100755 new mode 100644 diff --git a/misc/np2_u8.sh b/misc/np2_u8.sh old mode 100755 new mode 100644 diff --git a/misc/test_codecnv.c b/misc/test_codecnv.c old mode 100755 new mode 100644 diff --git a/misc/test_milstr.c b/misc/test_milstr.c old mode 100755 new mode 100644 diff --git a/network/lgy98.c b/network/lgy98.c old mode 100755 new mode 100644 diff --git a/network/lgy98.h b/network/lgy98.h old mode 100755 new mode 100644 diff --git a/network/lgy98dev.h b/network/lgy98dev.h old mode 100755 new mode 100644 diff --git a/network/net.c b/network/net.c old mode 100755 new mode 100644 diff --git a/network/net.h b/network/net.h old mode 100755 new mode 100644 diff --git a/network/readme.txt b/network/readme.txt old mode 100755 new mode 100644 diff --git a/nevent.c b/nevent.c old mode 100755 new mode 100644 diff --git a/nevent.h b/nevent.h old mode 100755 new mode 100644 diff --git a/np2_tickcount.c b/np2_tickcount.c old mode 100755 new mode 100644 diff --git a/np2ver.h b/np2ver.h old mode 100755 new mode 100644 diff --git a/pccore.h b/pccore.h old mode 100755 new mode 100644 diff --git a/readme.txt b/readme.txt old mode 100755 new mode 100644 diff --git a/sdl/Makefile b/sdl/Makefile old mode 100755 new mode 100644 diff --git a/sdl/Makefile.common b/sdl/Makefile.common old mode 100755 new mode 100644 diff --git a/sdl/Makefile.libretro b/sdl/Makefile.libretro old mode 100755 new mode 100644 diff --git a/sdl/ank10.res b/sdl/ank10.res old mode 100755 new mode 100644 diff --git a/sdl/ank12.res b/sdl/ank12.res old mode 100755 new mode 100644 diff --git a/sdl/cmmidi.c b/sdl/cmmidi.c old mode 100755 new mode 100644 diff --git a/sdl/cmmidi.h b/sdl/cmmidi.h old mode 100755 new mode 100644 diff --git a/sdl/cmpara.h b/sdl/cmpara.h old mode 100755 new mode 100644 diff --git a/sdl/cmserial.c b/sdl/cmserial.c old mode 100755 new mode 100644 diff --git a/sdl/cmserial.h b/sdl/cmserial.h old mode 100755 new mode 100644 diff --git a/sdl/commng.c b/sdl/commng.c old mode 100755 new mode 100644 diff --git a/sdl/commng.h b/sdl/commng.h old mode 100755 new mode 100644 diff --git a/sdl/dosio.c b/sdl/dosio.c old mode 100755 new mode 100644 diff --git a/sdl/dosio.h b/sdl/dosio.h old mode 100755 new mode 100644 diff --git a/sdl/fontmng.h b/sdl/fontmng.h old mode 100755 new mode 100644 diff --git a/sdl/ini.c b/sdl/ini.c old mode 100755 new mode 100644 diff --git a/sdl/ini.h b/sdl/ini.h old mode 100755 new mode 100644 diff --git a/sdl/inputmng.c b/sdl/inputmng.c old mode 100755 new mode 100644 diff --git a/sdl/inputmng.h b/sdl/inputmng.h old mode 100755 new mode 100644 diff --git a/sdl/joymng.c b/sdl/joymng.c old mode 100755 new mode 100644 diff --git a/sdl/joymng.h b/sdl/joymng.h old mode 100755 new mode 100644 diff --git a/sdl/kbdmng.h b/sdl/kbdmng.h old mode 100755 new mode 100644 diff --git a/sdl/kbtrans.c b/sdl/kbtrans.c old mode 100755 new mode 100644 diff --git a/sdl/kbtrans.h b/sdl/kbtrans.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/.bsv b/sdl/libretro/.bsv old mode 100755 new mode 100644 diff --git a/sdl/libretro/compiler.h b/sdl/libretro/compiler.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/emu_exports.h b/sdl/libretro/emu_exports.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/formats/json/jsonsax_full.c b/sdl/libretro/libretro-common/formats/json/jsonsax_full.c old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/formats/libchdr/libchdr_bitstream.c b/sdl/libretro/libretro-common/formats/libchdr/libchdr_bitstream.c old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/formats/libchdr/libchdr_cdrom.c b/sdl/libretro/libretro-common/formats/libchdr/libchdr_cdrom.c old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/formats/libchdr/libchdr_zlib.c b/sdl/libretro/libretro-common/formats/libchdr/libchdr_zlib.c old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/compat/msvc/stdint.h b/sdl/libretro/libretro-common/include/compat/msvc/stdint.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/glsym/glsym_es2.h b/sdl/libretro/libretro-common/include/glsym/glsym_es2.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/glsym/glsym_es3.h b/sdl/libretro/libretro-common/include/glsym/glsym_es3.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/glsym/switch/nx_glsym.h b/sdl/libretro/libretro-common/include/glsym/switch/nx_glsym.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/libchdr/bitstream.h b/sdl/libretro/libretro-common/include/libchdr/bitstream.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/libchdr/cdrom.h b/sdl/libretro/libretro-common/include/libchdr/cdrom.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/libchdr/coretypes.h b/sdl/libretro/libretro-common/include/libchdr/coretypes.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/libchdr/flac.h b/sdl/libretro/libretro-common/include/libchdr/flac.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/libchdr/huffman.h b/sdl/libretro/libretro-common/include/libchdr/huffman.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/libchdr/libchdr_zlib.h b/sdl/libretro/libretro-common/include/libchdr/libchdr_zlib.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/libchdr/lzma.h b/sdl/libretro/libretro-common/include/libchdr/lzma.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/libchdr/minmax.h b/sdl/libretro/libretro-common/include/libchdr/minmax.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/retro_inline.h b/sdl/libretro/libretro-common/include/retro_inline.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/rhash.h b/sdl/libretro/libretro-common/include/rhash.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/utils/md5.h b/sdl/libretro/libretro-common/include/utils/md5.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro-common/include/vulkan/vulkan_symbol_wrapper.h b/sdl/libretro/libretro-common/include/vulkan/vulkan_symbol_wrapper.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro.c b/sdl/libretro/libretro.c old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro_exports.h b/sdl/libretro/libretro_exports.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/libretro_params.h b/sdl/libretro/libretro_params.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/sdlremap/sdl.h b/sdl/libretro/sdlremap/sdl.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/sdlremap/sdl_keycode.h b/sdl/libretro/sdlremap/sdl_keycode.h old mode 100755 new mode 100644 diff --git a/sdl/libretro/sdlremap/sdl_scancode.h b/sdl/libretro/sdlremap/sdl_scancode.h old mode 100755 new mode 100644 diff --git a/sdl/link.T b/sdl/link.T old mode 100755 new mode 100644 diff --git a/sdl/mousemng.c b/sdl/mousemng.c old mode 100755 new mode 100644 diff --git a/sdl/mousemng.h b/sdl/mousemng.h old mode 100755 new mode 100644 diff --git a/sdl/np2.c b/sdl/np2.c old mode 100755 new mode 100644 diff --git a/sdl/np2.h b/sdl/np2.h old mode 100755 new mode 100644 diff --git a/sdl/oemtext.h b/sdl/oemtext.h old mode 100755 new mode 100644 diff --git a/sdl/opendingux/compiler.h b/sdl/opendingux/compiler.h old mode 100755 new mode 100644 diff --git a/sdl/opendingux/main.c b/sdl/opendingux/main.c old mode 100755 new mode 100644 diff --git a/sdl/opendingux/opk/default_opendingux_np21kai_desktop b/sdl/opendingux/opk/default_opendingux_np21kai_desktop old mode 100755 new mode 100644 diff --git a/sdl/opendingux/opk/default_opendingux_np2kai_desktop b/sdl/opendingux/opk/default_opendingux_np2kai_desktop old mode 100755 new mode 100644 diff --git a/sdl/opendingux/opk/np2.png b/sdl/opendingux/opk/np2.png old mode 100755 new mode 100644 diff --git a/sdl/scrnmng.c b/sdl/scrnmng.c old mode 100755 new mode 100644 diff --git a/sdl/scrnmng.h b/sdl/scrnmng.h old mode 100755 new mode 100644 diff --git a/sdl/soundmng.c b/sdl/soundmng.c old mode 100755 new mode 100644 diff --git a/sdl/soundmng.h b/sdl/soundmng.h old mode 100755 new mode 100644 diff --git a/sdl/sysmenu.c b/sdl/sysmenu.c old mode 100755 new mode 100644 diff --git a/sdl/sysmenu.h b/sdl/sysmenu.h old mode 100755 new mode 100644 diff --git a/sdl/sysmenu.res b/sdl/sysmenu.res old mode 100755 new mode 100644 diff --git a/sdl/sysmenu.str b/sdl/sysmenu.str old mode 100755 new mode 100644 diff --git a/sdl/sysmng.c b/sdl/sysmng.c old mode 100755 new mode 100644 diff --git a/sdl/sysmng.h b/sdl/sysmng.h old mode 100755 new mode 100644 diff --git a/sdl/taskmng.c b/sdl/taskmng.c old mode 100755 new mode 100644 diff --git a/sdl/taskmng.h b/sdl/taskmng.h old mode 100755 new mode 100644 diff --git a/sdl/timemng.c b/sdl/timemng.c old mode 100755 new mode 100644 diff --git a/sdl/timemng.h b/sdl/timemng.h old mode 100755 new mode 100644 diff --git a/sdl/trace.c b/sdl/trace.c old mode 100755 new mode 100644 diff --git a/sdl/trace.h b/sdl/trace.h old mode 100755 new mode 100644 diff --git a/sdl/unix/compiler.h b/sdl/unix/compiler.h old mode 100755 new mode 100644 diff --git a/sdl/unix/main.c b/sdl/unix/main.c old mode 100755 new mode 100644 diff --git a/sdl/windows/compiler.h b/sdl/windows/compiler.h old mode 100755 new mode 100644 diff --git a/sdl/windows/main.c b/sdl/windows/main.c old mode 100755 new mode 100644 diff --git a/sound/adpcm.h b/sound/adpcm.h old mode 100755 new mode 100644 diff --git a/sound/adpcmc.c b/sound/adpcmc.c old mode 100755 new mode 100644 diff --git a/sound/adpcmg.c b/sound/adpcmg.c old mode 100755 new mode 100644 diff --git a/sound/beep.h b/sound/beep.h old mode 100755 new mode 100644 diff --git a/sound/beepc.c b/sound/beepc.c old mode 100755 new mode 100644 diff --git a/sound/beepg.c b/sound/beepg.c old mode 100755 new mode 100644 diff --git a/sound/cs4231.h b/sound/cs4231.h old mode 100755 new mode 100644 diff --git a/sound/cs4231c.c b/sound/cs4231c.c old mode 100755 new mode 100644 diff --git a/sound/cs4231g.c b/sound/cs4231g.c old mode 100755 new mode 100644 diff --git a/sound/fmboard.c b/sound/fmboard.c old mode 100755 new mode 100644 diff --git a/sound/fmboard.h b/sound/fmboard.h old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_diag.h b/sound/fmgen/fmgen_diag.h old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_file.cpp b/sound/fmgen/fmgen_file.cpp old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_file.h b/sound/fmgen/fmgen_file.h old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_fmgen.cpp b/sound/fmgen/fmgen_fmgen.cpp old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_fmgen.h b/sound/fmgen/fmgen_fmgen.h old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_fmgeninl.h b/sound/fmgen/fmgen_fmgeninl.h old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_fmgwrap.cpp b/sound/fmgen/fmgen_fmgwrap.cpp old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_fmgwrap.h b/sound/fmgen/fmgen_fmgwrap.h old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_fmtimer.cpp b/sound/fmgen/fmgen_fmtimer.cpp old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_fmtimer.h b/sound/fmgen/fmgen_fmtimer.h old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_headers.h b/sound/fmgen/fmgen_headers.h old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_misc.h b/sound/fmgen/fmgen_misc.h old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_opm.cpp b/sound/fmgen/fmgen_opm.cpp old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_opm.h b/sound/fmgen/fmgen_opm.h old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_opna.cpp b/sound/fmgen/fmgen_opna.cpp old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_opna.h b/sound/fmgen/fmgen_opna.h old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_psg.cpp b/sound/fmgen/fmgen_psg.cpp old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_psg.h b/sound/fmgen/fmgen_psg.h old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_readme.txt b/sound/fmgen/fmgen_readme.txt old mode 100755 new mode 100644 diff --git a/sound/fmgen/fmgen_readme_kai.txt b/sound/fmgen/fmgen_readme_kai.txt old mode 100755 new mode 100644 diff --git a/sound/getsnd/getmp3.c b/sound/getsnd/getmp3.c old mode 100755 new mode 100644 diff --git a/sound/getsnd/getogg.c b/sound/getsnd/getogg.c old mode 100755 new mode 100644 diff --git a/sound/getsnd/getsmix.c b/sound/getsnd/getsmix.c old mode 100755 new mode 100644 diff --git a/sound/getsnd/getsnd.c b/sound/getsnd/getsnd.c old mode 100755 new mode 100644 diff --git a/sound/getsnd/getsnd.h b/sound/getsnd/getsnd.h old mode 100755 new mode 100644 diff --git a/sound/getsnd/getsndmn.mcr b/sound/getsnd/getsndmn.mcr old mode 100755 new mode 100644 diff --git a/sound/getsnd/getsndst.mcr b/sound/getsnd/getsndst.mcr old mode 100755 new mode 100644 diff --git a/sound/getsnd/getwave.c b/sound/getsnd/getwave.c old mode 100755 new mode 100644 diff --git a/sound/mame/driver.h b/sound/mame/driver.h old mode 100755 new mode 100644 diff --git a/sound/mame/fm.h b/sound/mame/fm.h old mode 100755 new mode 100644 diff --git a/sound/mame/fmopl.c b/sound/mame/fmopl.c old mode 100755 new mode 100644 diff --git a/sound/mame/fmopl.h b/sound/mame/fmopl.h old mode 100755 new mode 100644 diff --git a/sound/mame/ymdeltat.c b/sound/mame/ymdeltat.c old mode 100755 new mode 100644 diff --git a/sound/mame/ymdeltat.h b/sound/mame/ymdeltat.h old mode 100755 new mode 100644 diff --git a/sound/mame/ymf262.h b/sound/mame/ymf262.h old mode 100755 new mode 100644 diff --git a/sound/opl3.c b/sound/opl3.c old mode 100755 new mode 100644 diff --git a/sound/opl3.h b/sound/opl3.h old mode 100755 new mode 100644 diff --git a/sound/oplgen.h b/sound/oplgen.h old mode 100755 new mode 100644 diff --git a/sound/oplgenc.c b/sound/oplgenc.c old mode 100755 new mode 100644 diff --git a/sound/oplgencfg.h b/sound/oplgencfg.h old mode 100755 new mode 100644 diff --git a/sound/oplgeng.c b/sound/oplgeng.c old mode 100755 new mode 100644 diff --git a/sound/opna.c b/sound/opna.c old mode 100755 new mode 100644 diff --git a/sound/opna.h b/sound/opna.h old mode 100755 new mode 100644 diff --git a/sound/opngen.h b/sound/opngen.h old mode 100755 new mode 100644 diff --git a/sound/opngenc.c b/sound/opngenc.c old mode 100755 new mode 100644 diff --git a/sound/opngencfg.h b/sound/opngencfg.h old mode 100755 new mode 100644 diff --git a/sound/opngeng.c b/sound/opngeng.c old mode 100755 new mode 100644 diff --git a/sound/opntimer.c b/sound/opntimer.c old mode 100755 new mode 100644 diff --git a/sound/opntimer.h b/sound/opntimer.h old mode 100755 new mode 100644 diff --git a/sound/pcm86.h b/sound/pcm86.h old mode 100755 new mode 100644 diff --git a/sound/pcm86c.c b/sound/pcm86c.c old mode 100755 new mode 100644 diff --git a/sound/pcm86g.c b/sound/pcm86g.c old mode 100755 new mode 100644 diff --git a/sound/pcmmix.c b/sound/pcmmix.c old mode 100755 new mode 100644 diff --git a/sound/pcmmix.h b/sound/pcmmix.h old mode 100755 new mode 100644 diff --git a/sound/psggen.h b/sound/psggen.h old mode 100755 new mode 100644 diff --git a/sound/psggenc.c b/sound/psggenc.c old mode 100755 new mode 100644 diff --git a/sound/psggeng.c b/sound/psggeng.c old mode 100755 new mode 100644 diff --git a/sound/rhythm.h b/sound/rhythm.h old mode 100755 new mode 100644 diff --git a/sound/rhythmc.c b/sound/rhythmc.c old mode 100755 new mode 100644 diff --git a/sound/s98.c b/sound/s98.c old mode 100755 new mode 100644 diff --git a/sound/s98.h b/sound/s98.h old mode 100755 new mode 100644 diff --git a/sound/sndcsec.c b/sound/sndcsec.c old mode 100755 new mode 100644 diff --git a/sound/sndcsec.h b/sound/sndcsec.h old mode 100755 new mode 100644 diff --git a/sound/sound.c b/sound/sound.c old mode 100755 new mode 100644 diff --git a/sound/sound.h b/sound/sound.h old mode 100755 new mode 100644 diff --git a/sound/soundrom.c b/sound/soundrom.c old mode 100755 new mode 100644 diff --git a/sound/soundrom.h b/sound/soundrom.h old mode 100755 new mode 100644 diff --git a/sound/tms3631.h b/sound/tms3631.h old mode 100755 new mode 100644 diff --git a/sound/tms3631c.c b/sound/tms3631c.c old mode 100755 new mode 100644 diff --git a/sound/tms3631g.c b/sound/tms3631g.c old mode 100755 new mode 100644 diff --git a/sound/vermouth/midimod.c b/sound/vermouth/midimod.c old mode 100755 new mode 100644 diff --git a/sound/vermouth/midimod.h b/sound/vermouth/midimod.h old mode 100755 new mode 100644 diff --git a/sound/vermouth/midinst.c b/sound/vermouth/midinst.c old mode 100755 new mode 100644 diff --git a/sound/vermouth/midinst.h b/sound/vermouth/midinst.h old mode 100755 new mode 100644 diff --git a/sound/vermouth/midiout.c b/sound/vermouth/midiout.c old mode 100755 new mode 100644 diff --git a/sound/vermouth/midiout.h b/sound/vermouth/midiout.h old mode 100755 new mode 100644 diff --git a/sound/vermouth/midtable.c b/sound/vermouth/midtable.c old mode 100755 new mode 100644 diff --git a/sound/vermouth/midtable.h b/sound/vermouth/midtable.h old mode 100755 new mode 100644 diff --git a/sound/vermouth/midvoice.c b/sound/vermouth/midvoice.c old mode 100755 new mode 100644 diff --git a/sound/vermouth/midvoice.h b/sound/vermouth/midvoice.h old mode 100755 new mode 100644 diff --git a/sound/vermouth/vermouth.h b/sound/vermouth/vermouth.h old mode 100755 new mode 100644 diff --git a/statsave.c b/statsave.c old mode 100755 new mode 100644 diff --git a/statsave.h b/statsave.h old mode 100755 new mode 100644 diff --git a/statsave.tbl b/statsave.tbl old mode 100755 new mode 100644 diff --git a/timing.c b/timing.c old mode 100755 new mode 100644 diff --git a/timing.h b/timing.h old mode 100755 new mode 100644 diff --git a/trap/inttrap.c b/trap/inttrap.c old mode 100755 new mode 100644 diff --git a/trap/inttrap.h b/trap/inttrap.h old mode 100755 new mode 100644 diff --git a/trap/steptrap.c b/trap/steptrap.c old mode 100755 new mode 100644 diff --git a/trap/steptrap.h b/trap/steptrap.h old mode 100755 new mode 100644 diff --git a/update.txt b/update.txt old mode 100755 new mode 100644 diff --git a/vram/dispsync.c b/vram/dispsync.c old mode 100644 new mode 100755 index 7e03f53a..a761af26 --- a/vram/dispsync.c +++ b/vram/dispsync.c @@ -1,151 +1,151 @@ -#include "compiler.h" -#include "scrnmng.h" -#include "pccore.h" -#include "iocore.h" -#include "scrndraw.h" -#include "dispsync.h" - - - DSYNC dsync; - - -void dispsync_initialize(void) { - - ZeroMemory(&dsync, sizeof(dsync)); - dsync.textymax = 400; - dsync.grphymax = 400; - - dsync.scrnxmax = 640; - dsync.scrnxextend = 0; - dsync.scrnymax = 400; - -// scrnmng_setwidth(0, 640); -// scrnmng_setextend(0); -// scrnmng_setheight(0, 400); -} - -BOOL dispsync_renewalmode(void) { - - UINT disp; - - if (!scrnmng_haveextend()) { - return(FALSE); - } - disp = 0; - if ((!(np2cfg.LCD_MODE & 1)) && ((gdc.display & 7) < 3)) { - disp = 1; - } - if (dsync.scrnxextend != disp) { - dsync.scrnxextend = disp; - scrnmng_setextend(disp); - return(TRUE); - } - return(FALSE); -} - -BOOL dispsync_renewalhorizontal(void) { - - UINT hbp; - UINT cr; - UINT scrnxpos; - UINT scrnxmax; - - hbp = gdc.m.para[GDC_SYNC + 4] & 0x1f; - cr = gdc.m.para[GDC_SYNC + 1]; - - scrnxpos = 0; - if (hbp >= 7) { - scrnxpos = hbp - 7; - } - scrnxmax = cr + 2; - if ((scrnxpos + scrnxmax) > 80) { - scrnxmax = min(scrnxmax, 80); - scrnxpos = 80 - scrnxmax; - } - scrnxpos <<= 3; - scrnxmax <<= 3; - if ((dsync.scrnxpos != scrnxpos) || (dsync.scrnxmax != scrnxmax)) { - dsync.scrnxpos = scrnxpos; - dsync.scrnxmax = scrnxmax; - scrnmng_setwidth(scrnxpos, scrnxmax); - return(TRUE); - } - else { - return(FALSE); - } -} - -BOOL dispsync_renewalvertical(void) { - - UINT text_vbp; - UINT grph_vbp; - UINT textymax; - UINT grphymax; - UINT scrnymax; - - text_vbp = gdc.m.para[GDC_SYNC + 7] >> 2; - grph_vbp = gdc.s.para[GDC_SYNC + 7] >> 2; - if (text_vbp >= grph_vbp) { - text_vbp -= grph_vbp; - grph_vbp = 0; - } - else { - grph_vbp -= text_vbp; - text_vbp = 0; - } - - textymax = LOADINTELWORD(gdc.m.para + GDC_SYNC + 6); - textymax = ((textymax - 1) & 0x3ff) + 1; - textymax += text_vbp; - - grphymax = LOADINTELWORD(gdc.s.para + GDC_SYNC + 6); - grphymax = ((grphymax - 1) & 0x3ff) + 1; - grphymax += grph_vbp; - -#if defined(SUPPORT_CRT15KHZ) - if (gdc.crt15khz & 2) { - textymax *= 2; - grphymax *= 2; - } -#endif - if (textymax > SURFACE_HEIGHT) { - textymax = SURFACE_HEIGHT; - } - if (grphymax > SURFACE_HEIGHT) { - grphymax = SURFACE_HEIGHT; - } - if ((dsync.text_vbp == text_vbp) && (dsync.grph_vbp == grph_vbp) && - (dsync.textymax == textymax) && (dsync.grphymax == grphymax)) { - return(FALSE); - } - dsync.text_vbp = text_vbp; - dsync.grph_vbp = grph_vbp; - dsync.textymax = textymax; - dsync.grphymax = grphymax; - - scrnymax = max(grphymax, textymax); - scrnymax = (scrnymax + 7) & (~7); - if (dsync.scrnymax != scrnymax) { - dsync.scrnymax = scrnymax; - scrnmng_setheight(0, scrnymax); - } - - dsync.textvad = text_vbp * 640; - dsync.grphvad = grph_vbp * 640; - if (text_vbp) { - ZeroMemory(np2_tram, text_vbp * 640); - } - if (scrnymax - textymax) { - ZeroMemory(np2_tram + textymax * 640, (scrnymax - textymax) * 640); - } - if (grph_vbp) { - ZeroMemory(np2_vram[0], grph_vbp * 640); - ZeroMemory(np2_vram[1], grph_vbp * 640); - } - if (scrnymax - grphymax) { - ZeroMemory(np2_vram[0] + grphymax * 640, (scrnymax - grphymax) * 640); - ZeroMemory(np2_vram[1] + grphymax * 640, (scrnymax - grphymax) * 640); - } - return(TRUE); -} - +#include +#include +#include +#include +#include +#include + + + DSYNC dsync; + + +void dispsync_initialize(void) { + + ZeroMemory(&dsync, sizeof(dsync)); + dsync.textymax = 400; + dsync.grphymax = 400; + + dsync.scrnxmax = 640; + dsync.scrnxextend = 0; + dsync.scrnymax = 400; + +// scrnmng_setwidth(0, 640); +// scrnmng_setextend(0); +// scrnmng_setheight(0, 400); +} + +BOOL dispsync_renewalmode(void) { + + UINT disp; + + if (!scrnmng_haveextend()) { + return(FALSE); + } + disp = 0; + if ((!(np2cfg.LCD_MODE & 1)) && ((gdc.display & 7) < 3)) { + disp = 1; + } + if (dsync.scrnxextend != disp) { + dsync.scrnxextend = disp; + scrnmng_setextend(disp); + return(TRUE); + } + return(FALSE); +} + +BOOL dispsync_renewalhorizontal(void) { + + UINT hbp; + UINT cr; + UINT scrnxpos; + UINT scrnxmax; + + hbp = gdc.m.para[GDC_SYNC + 4] & 0x1f; + cr = gdc.m.para[GDC_SYNC + 1]; + + scrnxpos = 0; + if (hbp >= 7) { + scrnxpos = hbp - 7; + } + scrnxmax = cr + 2; + if ((scrnxpos + scrnxmax) > 80) { + scrnxmax = MIN(scrnxmax, 80); + scrnxpos = 80 - scrnxmax; + } + scrnxpos <<= 3; + scrnxmax <<= 3; + if ((dsync.scrnxpos != scrnxpos) || (dsync.scrnxmax != scrnxmax)) { + dsync.scrnxpos = scrnxpos; + dsync.scrnxmax = scrnxmax; + scrnmng_setwidth(scrnxpos, scrnxmax); + return(TRUE); + } + else { + return(FALSE); + } +} + +BOOL dispsync_renewalvertical(void) { + + UINT text_vbp; + UINT grph_vbp; + UINT textymax; + UINT grphymax; + UINT scrnymax; + + text_vbp = gdc.m.para[GDC_SYNC + 7] >> 2; + grph_vbp = gdc.s.para[GDC_SYNC + 7] >> 2; + if (text_vbp >= grph_vbp) { + text_vbp -= grph_vbp; + grph_vbp = 0; + } + else { + grph_vbp -= text_vbp; + text_vbp = 0; + } + + textymax = LOADINTELWORD(gdc.m.para + GDC_SYNC + 6); + textymax = ((textymax - 1) & 0x3ff) + 1; + textymax += text_vbp; + + grphymax = LOADINTELWORD(gdc.s.para + GDC_SYNC + 6); + grphymax = ((grphymax - 1) & 0x3ff) + 1; + grphymax += grph_vbp; + +#if defined(SUPPORT_CRT15KHZ) + if (gdc.crt15khz & 2) { + textymax *= 2; + grphymax *= 2; + } +#endif + if (textymax > SURFACE_HEIGHT) { + textymax = SURFACE_HEIGHT; + } + if (grphymax > SURFACE_HEIGHT) { + grphymax = SURFACE_HEIGHT; + } + if ((dsync.text_vbp == text_vbp) && (dsync.grph_vbp == grph_vbp) && + (dsync.textymax == textymax) && (dsync.grphymax == grphymax)) { + return(FALSE); + } + dsync.text_vbp = text_vbp; + dsync.grph_vbp = grph_vbp; + dsync.textymax = textymax; + dsync.grphymax = grphymax; + + scrnymax = MAX(grphymax, textymax); + scrnymax = (scrnymax + 7) & (~7); + if (dsync.scrnymax != scrnymax) { + dsync.scrnymax = scrnymax; + scrnmng_setheight(0, scrnymax); + } + + dsync.textvad = text_vbp * 640; + dsync.grphvad = grph_vbp * 640; + if (text_vbp) { + ZeroMemory(np2_tram, text_vbp * 640); + } + if (scrnymax - textymax) { + ZeroMemory(np2_tram + textymax * 640, (scrnymax - textymax) * 640); + } + if (grph_vbp) { + ZeroMemory(np2_vram[0], grph_vbp * 640); + ZeroMemory(np2_vram[1], grph_vbp * 640); + } + if (scrnymax - grphymax) { + ZeroMemory(np2_vram[0] + grphymax * 640, (scrnymax - grphymax) * 640); + ZeroMemory(np2_vram[1] + grphymax * 640, (scrnymax - grphymax) * 640); + } + return(TRUE); +} + diff --git a/vram/dispsync.h b/vram/dispsync.h old mode 100644 new mode 100755 index 3e6bd4af..6e916916 --- a/vram/dispsync.h +++ b/vram/dispsync.h @@ -1,31 +1,31 @@ - -typedef struct { - UINT text_vbp; - UINT textymax; - UINT grph_vbp; - UINT grphymax; - - UINT scrnxpos; - UINT scrnxmax; - UINT scrnxextend; - UINT scrnymax; - UINT32 textvad; - UINT32 grphvad; -} DSYNC; - - -#ifdef __cplusplus -extern "C" { -#endif - -extern DSYNC dsync; - -void dispsync_initialize(void); -BOOL dispsync_renewalmode(void); -BOOL dispsync_renewalhorizontal(void); -BOOL dispsync_renewalvertical(void); - -#ifdef __cplusplus -} -#endif - + +typedef struct { + UINT text_vbp; + UINT textymax; + UINT grph_vbp; + UINT grphymax; + + UINT scrnxpos; + UINT scrnxmax; + UINT scrnxextend; + UINT scrnymax; + UINT32 textvad; + UINT32 grphvad; +} DSYNC; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern DSYNC dsync; + +void dispsync_initialize(void); +BOOL dispsync_renewalmode(void); +BOOL dispsync_renewalhorizontal(void); +BOOL dispsync_renewalvertical(void); + +#ifdef __cplusplus +} +#endif + diff --git a/vram/makegrex.c b/vram/makegrex.c old mode 100644 new mode 100755 index 761b822f..f70d4a1a --- a/vram/makegrex.c +++ b/vram/makegrex.c @@ -1,321 +1,321 @@ -#include "compiler.h" - -#if defined(SUPPORT_PC9821) - -#include "cpucore.h" -#include "pccore.h" -#include "iocore.h" -#include "vram.h" -#include "scrndraw.h" -#include "dispsync.h" -#include "makegrex.h" - - -typedef struct { - UINT32 *vm; - UINT liney; - UINT pitch; -} _MKGREX, *MKGREX; - - -static BOOL grphput_indirty0(MKGREX mkgrex, int gpos) { - - _MKGREX mg; - UINT vad; - UINT remain; - UINT vc; - UINT32 *p; - UINT32 *pterm; - - mg = *mkgrex; - vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); - vad = LOW15(vad << 1); - remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); - remain = LOW14(remain) >> 4; - while(1) { - vc = vad; - p = mg.vm; - pterm = p + (80 * 2); - do { - if (vramupdate[vc] & 1) { - renewal_line[mg.liney] |= 1; - p[0] = *(UINT32 *)(vramex + (vc * 8) + 0); - p[1] = *(UINT32 *)(vramex + (vc * 8) + 4); - } - vc = LOW15(vc + 1); - p += 2; - } while(p < pterm); - mg.liney++; - if (mg.liney >= dsync.grphymax) { - return(TRUE); - } - mg.vm += 80*2; - remain--; - if (!remain) { - break; - } - vad = LOW15(vad + mg.pitch); - } - mkgrex->vm = mg.vm; - mkgrex->liney = mg.liney; - return(FALSE); -} - -static BOOL grphput_all0(MKGREX mkgrex, int gpos) { - - _MKGREX mg; - UINT vad; - UINT remain; - UINT vc; - UINT32 *p; - UINT32 *pterm; - - mg = *mkgrex; - vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); - vad = LOW15(vad << 1); - remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); - remain = LOW14(remain) >> 4; - while(1) { - vc = vad; - p = mg.vm; - pterm = p + (80 * 2); - do { - p[0] = *(UINT32 *)(vramex + (vc * 8) + 0); - p[1] = *(UINT32 *)(vramex + (vc * 8) + 4); - vc = LOW15(vc + 1); - p += 2; - } while(p < pterm); - renewal_line[mg.liney] |= 1; - mg.liney++; - if (mg.liney >= dsync.grphymax) { - return(TRUE); - } - mg.vm += 80*2; - remain--; - if (!remain) { - break; - } - vad = LOW15(vad + mg.pitch); - } - mkgrex->vm = mg.vm; - mkgrex->liney = mg.liney; - return(FALSE); -} - -static BOOL grphput_indirty1(MKGREX mkgrex, int gpos) { - - _MKGREX mg; - UINT vad; - UINT remain; - UINT vc; - UINT32 *p; - UINT32 *pterm; - - mg = *mkgrex; - vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); - vad = LOW15(vad << 1); - remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); - remain = LOW14(remain) >> 4; - while(1) { - vc = vad; - p = mg.vm; - pterm = p + (80 * 2); - do { - if (vramupdate[vc] & 2) { - renewal_line[mg.liney] |= 2; - p[0] = *(UINT32 *)(vramex + 0x40000 + (vc * 8) + 0); - p[1] = *(UINT32 *)(vramex + 0x40000 + (vc * 8) + 4); - } - vc = LOW15(vc + 1); - p += 2; - } while(p < pterm); - mg.liney++; - if (mg.liney >= dsync.grphymax) { - return(TRUE); - } - mg.vm += 80*2; - remain--; - if (!remain) { - break; - } - vad = LOW15(vad + mg.pitch); - } - mkgrex->vm = mg.vm; - mkgrex->liney = mg.liney; - return(FALSE); -} - -static BOOL grphput_all1(MKGREX mkgrex, int gpos) { - - _MKGREX mg; - UINT vad; - UINT remain; - UINT vc; - UINT32 *p; - UINT32 *pterm; - - mg = *mkgrex; - vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); - vad = LOW15(vad << 1); - remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); - remain = LOW14(remain) >> 4; - while(1) { - vc = vad; - p = mg.vm; - pterm = p + (80 * 2); - do { - p[0] = *(UINT32 *)(vramex + 0x40000 + (vc * 8) + 0); - p[1] = *(UINT32 *)(vramex + 0x40000 + (vc * 8) + 4); - vc = LOW15(vc + 1); - p += 2; - } while(p < pterm); - renewal_line[mg.liney] |= 2; - mg.liney++; - if (mg.liney >= dsync.grphymax) { - return(TRUE); - } - mg.vm += 80*2; - remain--; - if (!remain) { - break; - } - vad = LOW15(vad + mg.pitch); - } - mkgrex->vm = mg.vm; - mkgrex->liney = mg.liney; - return(FALSE); -} - - -// ---- all - -static BOOL grphput_indirty(MKGREX mkgrex, int gpos) { - - _MKGREX mg; - UINT vad; - UINT remain; - UINT vc; - UINT32 *p; - UINT32 *pterm; - - mg = *mkgrex; - vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); - vad = LOW16(vad << 1); - remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); - remain = LOW15(remain) >> 4; - while(1) { - vc = vad; - p = mg.vm; - pterm = p + (80 * 2); - do { - if (vramupdate[LOW15(vc)] & 3) { - renewal_line[mg.liney] |= 3; - p[0] = *(UINT32 *)(vramex + (vc * 8) + 0); - p[1] = *(UINT32 *)(vramex + (vc * 8) + 4); - } - vc = LOW16(vc + 1); - p += 2; - } while(p < pterm); - mg.liney++; - if (mg.liney >= dsync.grphymax) { - return(TRUE); - } - mg.vm += 80*2; - remain--; - if (!remain) { - break; - } - vad = LOW16(vad + mg.pitch); - } - mkgrex->vm = mg.vm; - mkgrex->liney = mg.liney; - return(FALSE); -} - -static BOOL grphput_all(MKGREX mkgrex, int gpos) { - - _MKGREX mg; - UINT vad; - UINT remain; - UINT vc; - UINT32 *p; - UINT32 *pterm; - - mg = *mkgrex; - vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); - vad = LOW16(vad << 1); - remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); - remain = LOW15(remain) >> 4; - while(1) { - vc = vad; - p = mg.vm; - pterm = p + (80 * 2); - do { - p[0] = *(UINT32 *)(vramex + (vc * 8) + 0); - p[1] = *(UINT32 *)(vramex + (vc * 8) + 4); - vc = LOW16(vc + 1); - p += 2; - } while(p < pterm); - renewal_line[mg.liney] |= 3; - mg.liney++; - if (mg.liney >= dsync.grphymax) { - return(TRUE); - } - mg.vm += 80*2; - remain--; - if (!remain) { - break; - } - vad = LOW16(vad + mg.pitch); - } - mkgrex->vm = mg.vm; - mkgrex->liney = mg.liney; - return(FALSE); -} - - -// ---- - -void VRAMCALL makegrphex(int page, int alldraw) { - - _MKGREX mg; - int i; - BOOL (*grphput)(MKGREX mkgrex, int gpos); - UINT32 mask; - - mg.pitch = gdc.s.para[GDC_PITCH]; - if (!(gdc.clock & 0x80)) { - mg.pitch <<= 1; - } - mg.pitch &= 0xfe; - mg.liney = dsync.grph_vbp; - - if (gdc.analog & 4) { - mg.vm = (UINT32 *)(np2_vram[0] + dsync.grphvad); - grphput = (alldraw)?grphput_all:grphput_indirty; - mask = ~0x03030303; - } - else if (!page) { - mg.vm = (UINT32 *)(np2_vram[0] + dsync.grphvad); - grphput = (alldraw)?grphput_all0:grphput_indirty0; - mask = ~0x01010101; - } - else { - mg.vm = (UINT32 *)(np2_vram[1] + dsync.grphvad); - grphput = (alldraw)?grphput_all1:grphput_indirty1; - mask = ~0x02020202; - } - while(1) { - if ((*grphput)(&mg, 0)) { - break; - } - if ((*grphput)(&mg, 4)) { - break; - } - } - for (i=0; i<0x8000; i+=4) { - *(UINT32 *)(vramupdate + i) &= mask; - } -} -#endif - +#include + +#if defined(SUPPORT_PC9821) + +#include +#include +#include +#include +#include +#include +#include + + +typedef struct { + UINT32 *vm; + UINT liney; + UINT pitch; +} _MKGREX, *MKGREX; + + +static BOOL grphput_indirty0(MKGREX mkgrex, int gpos) { + + _MKGREX mg; + UINT vad; + UINT remain; + UINT vc; + UINT32 *p; + UINT32 *pterm; + + mg = *mkgrex; + vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); + vad = LOW15(vad << 1); + remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); + remain = LOW14(remain) >> 4; + while(1) { + vc = vad; + p = mg.vm; + pterm = p + (80 * 2); + do { + if (vramupdate[vc] & 1) { + renewal_line[mg.liney] |= 1; + p[0] = *(UINT32 *)(vramex + (vc * 8) + 0); + p[1] = *(UINT32 *)(vramex + (vc * 8) + 4); + } + vc = LOW15(vc + 1); + p += 2; + } while(p < pterm); + mg.liney++; + if (mg.liney >= dsync.grphymax) { + return(TRUE); + } + mg.vm += 80*2; + remain--; + if (!remain) { + break; + } + vad = LOW15(vad + mg.pitch); + } + mkgrex->vm = mg.vm; + mkgrex->liney = mg.liney; + return(FALSE); +} + +static BOOL grphput_all0(MKGREX mkgrex, int gpos) { + + _MKGREX mg; + UINT vad; + UINT remain; + UINT vc; + UINT32 *p; + UINT32 *pterm; + + mg = *mkgrex; + vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); + vad = LOW15(vad << 1); + remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); + remain = LOW14(remain) >> 4; + while(1) { + vc = vad; + p = mg.vm; + pterm = p + (80 * 2); + do { + p[0] = *(UINT32 *)(vramex + (vc * 8) + 0); + p[1] = *(UINT32 *)(vramex + (vc * 8) + 4); + vc = LOW15(vc + 1); + p += 2; + } while(p < pterm); + renewal_line[mg.liney] |= 1; + mg.liney++; + if (mg.liney >= dsync.grphymax) { + return(TRUE); + } + mg.vm += 80*2; + remain--; + if (!remain) { + break; + } + vad = LOW15(vad + mg.pitch); + } + mkgrex->vm = mg.vm; + mkgrex->liney = mg.liney; + return(FALSE); +} + +static BOOL grphput_indirty1(MKGREX mkgrex, int gpos) { + + _MKGREX mg; + UINT vad; + UINT remain; + UINT vc; + UINT32 *p; + UINT32 *pterm; + + mg = *mkgrex; + vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); + vad = LOW15(vad << 1); + remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); + remain = LOW14(remain) >> 4; + while(1) { + vc = vad; + p = mg.vm; + pterm = p + (80 * 2); + do { + if (vramupdate[vc] & 2) { + renewal_line[mg.liney] |= 2; + p[0] = *(UINT32 *)(vramex + 0x40000 + (vc * 8) + 0); + p[1] = *(UINT32 *)(vramex + 0x40000 + (vc * 8) + 4); + } + vc = LOW15(vc + 1); + p += 2; + } while(p < pterm); + mg.liney++; + if (mg.liney >= dsync.grphymax) { + return(TRUE); + } + mg.vm += 80*2; + remain--; + if (!remain) { + break; + } + vad = LOW15(vad + mg.pitch); + } + mkgrex->vm = mg.vm; + mkgrex->liney = mg.liney; + return(FALSE); +} + +static BOOL grphput_all1(MKGREX mkgrex, int gpos) { + + _MKGREX mg; + UINT vad; + UINT remain; + UINT vc; + UINT32 *p; + UINT32 *pterm; + + mg = *mkgrex; + vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); + vad = LOW15(vad << 1); + remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); + remain = LOW14(remain) >> 4; + while(1) { + vc = vad; + p = mg.vm; + pterm = p + (80 * 2); + do { + p[0] = *(UINT32 *)(vramex + 0x40000 + (vc * 8) + 0); + p[1] = *(UINT32 *)(vramex + 0x40000 + (vc * 8) + 4); + vc = LOW15(vc + 1); + p += 2; + } while(p < pterm); + renewal_line[mg.liney] |= 2; + mg.liney++; + if (mg.liney >= dsync.grphymax) { + return(TRUE); + } + mg.vm += 80*2; + remain--; + if (!remain) { + break; + } + vad = LOW15(vad + mg.pitch); + } + mkgrex->vm = mg.vm; + mkgrex->liney = mg.liney; + return(FALSE); +} + + +// ---- all + +static BOOL grphput_indirty(MKGREX mkgrex, int gpos) { + + _MKGREX mg; + UINT vad; + UINT remain; + UINT vc; + UINT32 *p; + UINT32 *pterm; + + mg = *mkgrex; + vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); + vad = LOW16(vad << 1); + remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); + remain = LOW15(remain) >> 4; + while(1) { + vc = vad; + p = mg.vm; + pterm = p + (80 * 2); + do { + if (vramupdate[LOW15(vc)] & 3) { + renewal_line[mg.liney] |= 3; + p[0] = *(UINT32 *)(vramex + (vc * 8) + 0); + p[1] = *(UINT32 *)(vramex + (vc * 8) + 4); + } + vc = LOW16(vc + 1); + p += 2; + } while(p < pterm); + mg.liney++; + if (mg.liney >= dsync.grphymax) { + return(TRUE); + } + mg.vm += 80*2; + remain--; + if (!remain) { + break; + } + vad = LOW16(vad + mg.pitch); + } + mkgrex->vm = mg.vm; + mkgrex->liney = mg.liney; + return(FALSE); +} + +static BOOL grphput_all(MKGREX mkgrex, int gpos) { + + _MKGREX mg; + UINT vad; + UINT remain; + UINT vc; + UINT32 *p; + UINT32 *pterm; + + mg = *mkgrex; + vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); + vad = LOW16(vad << 1); + remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); + remain = LOW15(remain) >> 4; + while(1) { + vc = vad; + p = mg.vm; + pterm = p + (80 * 2); + do { + p[0] = *(UINT32 *)(vramex + (vc * 8) + 0); + p[1] = *(UINT32 *)(vramex + (vc * 8) + 4); + vc = LOW16(vc + 1); + p += 2; + } while(p < pterm); + renewal_line[mg.liney] |= 3; + mg.liney++; + if (mg.liney >= dsync.grphymax) { + return(TRUE); + } + mg.vm += 80*2; + remain--; + if (!remain) { + break; + } + vad = LOW16(vad + mg.pitch); + } + mkgrex->vm = mg.vm; + mkgrex->liney = mg.liney; + return(FALSE); +} + + +// ---- + +void VRAMCALL makegrphex(int page, int alldraw) { + + _MKGREX mg; + int i; + BOOL (*grphput)(MKGREX mkgrex, int gpos); + UINT32 mask; + + mg.pitch = gdc.s.para[GDC_PITCH]; + if (!(gdc.clock & 0x80)) { + mg.pitch <<= 1; + } + mg.pitch &= 0xfe; + mg.liney = dsync.grph_vbp; + + if (gdc.analog & 4) { + mg.vm = (UINT32 *)(np2_vram[0] + dsync.grphvad); + grphput = (alldraw)?grphput_all:grphput_indirty; + mask = ~0x03030303; + } + else if (!page) { + mg.vm = (UINT32 *)(np2_vram[0] + dsync.grphvad); + grphput = (alldraw)?grphput_all0:grphput_indirty0; + mask = ~0x01010101; + } + else { + mg.vm = (UINT32 *)(np2_vram[1] + dsync.grphvad); + grphput = (alldraw)?grphput_all1:grphput_indirty1; + mask = ~0x02020202; + } + while(1) { + if ((*grphput)(&mg, 0)) { + break; + } + if ((*grphput)(&mg, 4)) { + break; + } + } + for (i=0; i<0x8000; i+=4) { + *(UINT32 *)(vramupdate + i) &= mask; + } +} +#endif + diff --git a/vram/makegrex.h b/vram/makegrex.h old mode 100644 new mode 100755 index 1322124a..06faf8cf --- a/vram/makegrex.h +++ b/vram/makegrex.h @@ -1,15 +1,15 @@ - -#if defined(SUPPORT_PC9821) - -#ifdef __cplusplus -extern "C" { -#endif - -void VRAMCALL makegrphex(int page, int alldraw); - -#ifdef __cplusplus -} -#endif - -#endif - + +#if defined(SUPPORT_PC9821) + +#ifdef __cplusplus +extern "C" { +#endif + +void VRAMCALL makegrphex(int page, int alldraw); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/vram/makegrph.c b/vram/makegrph.c old mode 100644 new mode 100755 index 153d2fdb..e95ce37f --- a/vram/makegrph.c +++ b/vram/makegrph.c @@ -1,453 +1,453 @@ -#include "compiler.h" -#include "cpucore.h" -#include "pccore.h" -#include "iocore.h" -#include "vram.h" -#include "scrndraw.h" -#include "dispsync.h" -#include "makegrph.h" -#include "makegrph.mcr" - - -typedef struct { - UINT32 *vm; - UINT liney; -// UINT pitch; - UINT lr; -} _MKGRPH, *MKGRPH; - - -#if (!defined(MEMOPTIMIZE)) || (MEMOPTIMIZE == 0) - - UINT32 grph_table[4*256*2]; - -void makegrph_initialize(void) { - - int i, j; - UINT8 bit; - UINT32 tmp; - - tmp = 0; - for (i=0; i<256; i++) { -#if defined(BYTESEX_LITTLE) - for (bit=1; bit<0x10; bit<<=1) -#else - for (bit=8; bit; bit>>=1) -#endif - { - tmp <<= 8; - if (i & bit) { - tmp++; - } - } - for (j=0; j<4; j++, tmp<<=1) { - grph_table[j*512+i*2+1] = tmp; - } -#if defined(BYTESEX_LITTLE) - for (; bit; bit<<=1) -#else - for (bit=0x80; bit & 0xf0; bit>>=1) -#endif - { - tmp <<= 8; - if (i & bit) { - tmp++; - } - } - for (j=0; j<4; j++, tmp<<=1) { - grph_table[j*512+i*2+0] = tmp; - } - } -} - -#elif (MEMOPTIMIZE == 1) - - UINT32 grph_table1[256*2]; - -void makegrph_initialize(void) { - - int i; - UINT8 bit; - UINT32 tmp; - - tmp = 0; - for (i=0; i<256; i++) { -#if defined(BYTESEX_LITTLE) - for (bit=1; bit<0x10; bit<<=1) -#else - for (bit=8; bit; bit>>=1) -#endif - { - tmp <<= 8; - if (i & bit) { - tmp++; - } - } - grph_table1[i*2+1] = tmp; -#if defined(BYTESEX_LITTLE) - for (; bit; bit<<=1) -#else - for (bit=0x80; bit & 0xf0; bit>>=1) -#endif - { - tmp <<= 8; - if (i & bit) { - tmp++; - } - } - grph_table1[i*2+0] = tmp; - } -} - -#else - - UINT32 grph_table0[16]; - -void makegrph_initialize(void) { - - int i; - UINT8 bit; - UINT32 tmp; - - tmp = 0; - for (i=0; i<16; i++) { -#if defined(BYTESEX_LITTLE) - for (bit=1; bit<0x10; bit<<=1) -#else - for (bit=8; bit; bit>>=1) -#endif - { - tmp <<= 8; - if (i & bit) { - tmp++; - } - } - grph_table0[i] = tmp; - } -} -#endif - - -static BOOL grphput_indirty0(MKGRPH mkgrph, int gpos) { - - _MKGRPH mg; - UINT vad; - UINT remain; - UINT pitch; - UINT mul; - UINT vc; - UINT32 *p; - UINT32 *pterm; - - mg = *mkgrph; - vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); - vad = LOW15(vad << 1); - remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); - pitch = gdc.s.para[GDC_PITCH]; - if (!(remain & (1 << 14))) { - pitch <<= 1; - } - pitch &= 0xfe; - remain = LOW14(remain) >> 4; - mul = mg.lr; - while(1) { - if ((!(mg.liney & 1)) || (!(gdc.mode1 & 0x10))) { - vc = vad; - p = mg.vm; - pterm = p + (80 * 2); - do { - if (vramupdate[vc] & 1) { - renewal_line[mg.liney] |= 1; - GRPHDATASET(p, vc); - } - vc = LOW15(vc + 1); - p += 2; - } while(p < pterm); - } - mg.liney++; - if (mg.liney >= dsync.grphymax) { - return(TRUE); - } - mg.vm += 80*2; - remain--; - if (!remain) { - break; - } - mul--; - if (!mul) { - mul = mg.lr; - vad = LOW15(vad + pitch); - } - } - mkgrph->vm = mg.vm; - mkgrph->liney = mg.liney; - return(FALSE); -} - -static BOOL grphput_indirty1(MKGRPH mkgrph, int gpos) { - - _MKGRPH mg; - UINT vad; - UINT remain; - UINT pitch; - UINT mul; - UINT vc; - UINT32 *p; - UINT32 *pterm; - - mg = *mkgrph; - vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); - vad = LOW15(vad << 1); - remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); - pitch = gdc.s.para[GDC_PITCH]; - if (!(remain & (1 << 14))) { - pitch <<= 1; - } - pitch &= 0xfe; - remain = LOW14(remain) >> 4; - mul = mg.lr; - while(1) { - if ((!(mg.liney & 1)) || (!(gdc.mode1 & 0x10))) { - vc = vad; - p = mg.vm; - pterm = p + (80 * 2); - do { - if (vramupdate[vc] & 2) { - renewal_line[mg.liney] |= 2; - GRPHDATASET(p, vc + VRAM_STEP); - } - vc = LOW15(vc + 1); - p += 2; - } while(p < pterm); - } - mg.liney++; - if (mg.liney >= dsync.grphymax) { - return(TRUE); - } - mg.vm += 80*2; - remain--; - if (!remain) { - break; - } - mul--; - if (!mul) { - mul = mg.lr; - vad = LOW15(vad + pitch); - } - } - mkgrph->vm = mg.vm; - mkgrph->liney = mg.liney; - return(FALSE); -} - -static BOOL grphput_all0(MKGRPH mkgrph, int gpos) { - - _MKGRPH mg; - UINT vad; - UINT remain; - UINT pitch; - UINT mul; - UINT vc; - UINT32 *p; - UINT32 *pterm; - - mg = *mkgrph; - vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); - vad = LOW15(vad << 1); - remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); - pitch = gdc.s.para[GDC_PITCH]; - if (!(remain & (1 << 14))) { - pitch <<= 1; - } - pitch &= 0xfe; - remain = LOW14(remain) >> 4; - mul = mg.lr; - while(1) { - if ((!(mg.liney & 1)) || (!(gdc.mode1 & 0x10))) { - vc = vad; - p = mg.vm; - pterm = p + (80 * 2); - do { - GRPHDATASET(p, vc); - vc = LOW15(vc + 1); - p += 2; - } while(p < pterm); - } - renewal_line[mg.liney] |= 1; - mg.liney++; - if (mg.liney >= dsync.grphymax) { - return(TRUE); - } - mg.vm += 80*2; - remain--; - if (!remain) { - break; - } - mul--; - if (!mul) { - mul = mg.lr; - vad = LOW15(vad + pitch); - } - } - mkgrph->vm = mg.vm; - mkgrph->liney = mg.liney; - return(FALSE); -} - -static BOOL grphput_all1(MKGRPH mkgrph, int gpos) { - - _MKGRPH mg; - UINT vad; - UINT remain; - UINT pitch; - UINT mul; - UINT vc; - UINT32 *p; - UINT32 *pterm; - - mg = *mkgrph; - vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); - vad = LOW15(vad << 1); - remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); - pitch = gdc.s.para[GDC_PITCH]; - if (!(remain & (1 << 14))) { - pitch <<= 1; - } - pitch &= 0xfe; - remain = LOW14(remain) >> 4; - mul = mg.lr; - while(1) { - if ((!(mg.liney & 1)) || (!(gdc.mode1 & 0x10))) { - vc = vad; - p = mg.vm; - pterm = p + (80 * 2); - do { - GRPHDATASET(p, vc + VRAM_STEP); - vc = LOW15(vc + 1); - p += 2; - } while(p < pterm); - } - renewal_line[mg.liney] |= 2; - mg.liney++; - if (mg.liney >= dsync.grphymax) { - return(TRUE); - } - mg.vm += 80*2; - remain--; - if (!remain) { - break; - } - mul--; - if (!mul) { - mul = mg.lr; - vad = LOW15(vad + pitch); - } - } - mkgrph->vm = mg.vm; - mkgrph->liney = mg.liney; - return(FALSE); -} - -void VRAMCALL makegrph(int page, int alldraw) { - - _MKGRPH mg; - int i; - -// mg.pitch = gdc.s.para[GDC_PITCH]; -// if (!(gdc.clock & 0x80)) { -// mg.pitch <<= 1; -// } -// mg.pitch &= 0xfe; - mg.lr = (gdc.s.para[GDC_CSRFORM] & 0x1f) + 1; - mg.liney = dsync.grph_vbp; - - if (!page) { - mg.vm = (UINT32 *)(np2_vram[0] + dsync.grphvad); - if (!alldraw) { - while(1) { - if (grphput_indirty0(&mg, 0)) { - break; - } - if (grphput_indirty0(&mg, 4)) { - break; - } - if (np2cfg.uPD72020) { - continue; - } - if (grphput_indirty0(&mg, 8)) { - break; - } - if (grphput_indirty0(&mg, 12)) { - break; - } - } - } - else { - while(1) { - if (grphput_all0(&mg, 0)) { - break; - } - if (grphput_all0(&mg, 4)) { - break; - } - if (np2cfg.uPD72020) { - continue; - } - if (grphput_all0(&mg, 8)) { - break; - } - if (grphput_all0(&mg, 12)) { - break; - } - } - } - for (i=0; i<0x8000; i+=4) { - *(UINT32 *)(vramupdate + i) &= ~0x01010101; - } - } - else { - mg.vm = (UINT32 *)(np2_vram[1] + dsync.grphvad); - if (!alldraw) { - while(1) { - if (grphput_indirty1(&mg, 0)) { - break; - } - if (grphput_indirty1(&mg, 4)) { - break; - } - if (np2cfg.uPD72020) { - continue; - } - if (grphput_indirty1(&mg, 8)) { - break; - } - if (grphput_indirty1(&mg, 12)) { - break; - } - } - } - else { - while(1) { - if (grphput_all1(&mg, 0)) { - break; - } - if (grphput_all1(&mg, 4)) { - break; - } - if (np2cfg.uPD72020) { - continue; - } - if (grphput_all1(&mg, 8)) { - break; - } - if (grphput_all1(&mg, 12)) { - break; - } - } - } - for (i=0; i<0x8000; i+=4) { - *(UINT32 *)(vramupdate + i) &= ~0x02020202; - } - } -} - +#include +#include +#include +#include +#include +#include +#include +#include +#include "makegrph.mcr" + + +typedef struct { + UINT32 *vm; + UINT liney; +// UINT pitch; + UINT lr; +} _MKGRPH, *MKGRPH; + + +#if (!defined(MEMOPTIMIZE)) || (MEMOPTIMIZE == 0) + + UINT32 grph_table[4*256*2]; + +void makegrph_initialize(void) { + + int i, j; + UINT8 bit; + UINT32 tmp; + + tmp = 0; + for (i=0; i<256; i++) { +#if defined(BYTESEX_LITTLE) + for (bit=1; bit<0x10; bit<<=1) +#else + for (bit=8; bit; bit>>=1) +#endif + { + tmp <<= 8; + if (i & bit) { + tmp++; + } + } + for (j=0; j<4; j++, tmp<<=1) { + grph_table[j*512+i*2+1] = tmp; + } +#if defined(BYTESEX_LITTLE) + for (; bit; bit<<=1) +#else + for (bit=0x80; bit & 0xf0; bit>>=1) +#endif + { + tmp <<= 8; + if (i & bit) { + tmp++; + } + } + for (j=0; j<4; j++, tmp<<=1) { + grph_table[j*512+i*2+0] = tmp; + } + } +} + +#elif (MEMOPTIMIZE == 1) + + UINT32 grph_table1[256*2]; + +void makegrph_initialize(void) { + + int i; + UINT8 bit; + UINT32 tmp; + + tmp = 0; + for (i=0; i<256; i++) { +#if defined(BYTESEX_LITTLE) + for (bit=1; bit<0x10; bit<<=1) +#else + for (bit=8; bit; bit>>=1) +#endif + { + tmp <<= 8; + if (i & bit) { + tmp++; + } + } + grph_table1[i*2+1] = tmp; +#if defined(BYTESEX_LITTLE) + for (; bit; bit<<=1) +#else + for (bit=0x80; bit & 0xf0; bit>>=1) +#endif + { + tmp <<= 8; + if (i & bit) { + tmp++; + } + } + grph_table1[i*2+0] = tmp; + } +} + +#else + + UINT32 grph_table0[16]; + +void makegrph_initialize(void) { + + int i; + UINT8 bit; + UINT32 tmp; + + tmp = 0; + for (i=0; i<16; i++) { +#if defined(BYTESEX_LITTLE) + for (bit=1; bit<0x10; bit<<=1) +#else + for (bit=8; bit; bit>>=1) +#endif + { + tmp <<= 8; + if (i & bit) { + tmp++; + } + } + grph_table0[i] = tmp; + } +} +#endif + + +static BOOL grphput_indirty0(MKGRPH mkgrph, int gpos) { + + _MKGRPH mg; + UINT vad; + UINT remain; + UINT pitch; + UINT mul; + UINT vc; + UINT32 *p; + UINT32 *pterm; + + mg = *mkgrph; + vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); + vad = LOW15(vad << 1); + remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); + pitch = gdc.s.para[GDC_PITCH]; + if (!(remain & (1 << 14))) { + pitch <<= 1; + } + pitch &= 0xfe; + remain = LOW14(remain) >> 4; + mul = mg.lr; + while(1) { + if ((!(mg.liney & 1)) || (!(gdc.mode1 & 0x10))) { + vc = vad; + p = mg.vm; + pterm = p + (80 * 2); + do { + if (vramupdate[vc] & 1) { + renewal_line[mg.liney] |= 1; + GRPHDATASET(p, vc); + } + vc = LOW15(vc + 1); + p += 2; + } while(p < pterm); + } + mg.liney++; + if (mg.liney >= dsync.grphymax) { + return(TRUE); + } + mg.vm += 80*2; + remain--; + if (!remain) { + break; + } + mul--; + if (!mul) { + mul = mg.lr; + vad = LOW15(vad + pitch); + } + } + mkgrph->vm = mg.vm; + mkgrph->liney = mg.liney; + return(FALSE); +} + +static BOOL grphput_indirty1(MKGRPH mkgrph, int gpos) { + + _MKGRPH mg; + UINT vad; + UINT remain; + UINT pitch; + UINT mul; + UINT vc; + UINT32 *p; + UINT32 *pterm; + + mg = *mkgrph; + vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); + vad = LOW15(vad << 1); + remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); + pitch = gdc.s.para[GDC_PITCH]; + if (!(remain & (1 << 14))) { + pitch <<= 1; + } + pitch &= 0xfe; + remain = LOW14(remain) >> 4; + mul = mg.lr; + while(1) { + if ((!(mg.liney & 1)) || (!(gdc.mode1 & 0x10))) { + vc = vad; + p = mg.vm; + pterm = p + (80 * 2); + do { + if (vramupdate[vc] & 2) { + renewal_line[mg.liney] |= 2; + GRPHDATASET(p, vc + VRAM_STEP); + } + vc = LOW15(vc + 1); + p += 2; + } while(p < pterm); + } + mg.liney++; + if (mg.liney >= dsync.grphymax) { + return(TRUE); + } + mg.vm += 80*2; + remain--; + if (!remain) { + break; + } + mul--; + if (!mul) { + mul = mg.lr; + vad = LOW15(vad + pitch); + } + } + mkgrph->vm = mg.vm; + mkgrph->liney = mg.liney; + return(FALSE); +} + +static BOOL grphput_all0(MKGRPH mkgrph, int gpos) { + + _MKGRPH mg; + UINT vad; + UINT remain; + UINT pitch; + UINT mul; + UINT vc; + UINT32 *p; + UINT32 *pterm; + + mg = *mkgrph; + vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); + vad = LOW15(vad << 1); + remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); + pitch = gdc.s.para[GDC_PITCH]; + if (!(remain & (1 << 14))) { + pitch <<= 1; + } + pitch &= 0xfe; + remain = LOW14(remain) >> 4; + mul = mg.lr; + while(1) { + if ((!(mg.liney & 1)) || (!(gdc.mode1 & 0x10))) { + vc = vad; + p = mg.vm; + pterm = p + (80 * 2); + do { + GRPHDATASET(p, vc); + vc = LOW15(vc + 1); + p += 2; + } while(p < pterm); + } + renewal_line[mg.liney] |= 1; + mg.liney++; + if (mg.liney >= dsync.grphymax) { + return(TRUE); + } + mg.vm += 80*2; + remain--; + if (!remain) { + break; + } + mul--; + if (!mul) { + mul = mg.lr; + vad = LOW15(vad + pitch); + } + } + mkgrph->vm = mg.vm; + mkgrph->liney = mg.liney; + return(FALSE); +} + +static BOOL grphput_all1(MKGRPH mkgrph, int gpos) { + + _MKGRPH mg; + UINT vad; + UINT remain; + UINT pitch; + UINT mul; + UINT vc; + UINT32 *p; + UINT32 *pterm; + + mg = *mkgrph; + vad = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 0); + vad = LOW15(vad << 1); + remain = LOADINTELWORD(gdc.s.para + GDC_SCROLL + gpos + 2); + pitch = gdc.s.para[GDC_PITCH]; + if (!(remain & (1 << 14))) { + pitch <<= 1; + } + pitch &= 0xfe; + remain = LOW14(remain) >> 4; + mul = mg.lr; + while(1) { + if ((!(mg.liney & 1)) || (!(gdc.mode1 & 0x10))) { + vc = vad; + p = mg.vm; + pterm = p + (80 * 2); + do { + GRPHDATASET(p, vc + VRAM_STEP); + vc = LOW15(vc + 1); + p += 2; + } while(p < pterm); + } + renewal_line[mg.liney] |= 2; + mg.liney++; + if (mg.liney >= dsync.grphymax) { + return(TRUE); + } + mg.vm += 80*2; + remain--; + if (!remain) { + break; + } + mul--; + if (!mul) { + mul = mg.lr; + vad = LOW15(vad + pitch); + } + } + mkgrph->vm = mg.vm; + mkgrph->liney = mg.liney; + return(FALSE); +} + +void VRAMCALL makegrph(int page, int alldraw) { + + _MKGRPH mg; + int i; + +// mg.pitch = gdc.s.para[GDC_PITCH]; +// if (!(gdc.clock & 0x80)) { +// mg.pitch <<= 1; +// } +// mg.pitch &= 0xfe; + mg.lr = (gdc.s.para[GDC_CSRFORM] & 0x1f) + 1; + mg.liney = dsync.grph_vbp; + + if (!page) { + mg.vm = (UINT32 *)(np2_vram[0] + dsync.grphvad); + if (!alldraw) { + while(1) { + if (grphput_indirty0(&mg, 0)) { + break; + } + if (grphput_indirty0(&mg, 4)) { + break; + } + if (np2cfg.uPD72020) { + continue; + } + if (grphput_indirty0(&mg, 8)) { + break; + } + if (grphput_indirty0(&mg, 12)) { + break; + } + } + } + else { + while(1) { + if (grphput_all0(&mg, 0)) { + break; + } + if (grphput_all0(&mg, 4)) { + break; + } + if (np2cfg.uPD72020) { + continue; + } + if (grphput_all0(&mg, 8)) { + break; + } + if (grphput_all0(&mg, 12)) { + break; + } + } + } + for (i=0; i<0x8000; i+=4) { + *(UINT32 *)(vramupdate + i) &= ~0x01010101; + } + } + else { + mg.vm = (UINT32 *)(np2_vram[1] + dsync.grphvad); + if (!alldraw) { + while(1) { + if (grphput_indirty1(&mg, 0)) { + break; + } + if (grphput_indirty1(&mg, 4)) { + break; + } + if (np2cfg.uPD72020) { + continue; + } + if (grphput_indirty1(&mg, 8)) { + break; + } + if (grphput_indirty1(&mg, 12)) { + break; + } + } + } + else { + while(1) { + if (grphput_all1(&mg, 0)) { + break; + } + if (grphput_all1(&mg, 4)) { + break; + } + if (np2cfg.uPD72020) { + continue; + } + if (grphput_all1(&mg, 8)) { + break; + } + if (grphput_all1(&mg, 12)) { + break; + } + } + } + for (i=0; i<0x8000; i+=4) { + *(UINT32 *)(vramupdate + i) &= ~0x02020202; + } + } +} + diff --git a/vram/makegrph.h b/vram/makegrph.h old mode 100644 new mode 100755 index 9ab45d40..c276afe6 --- a/vram/makegrph.h +++ b/vram/makegrph.h @@ -1,18 +1,18 @@ - -enum { - GRPHXMAX = 80, - GRPHYMAX = 400 -}; - - -#ifdef __cplusplus -extern "C" { -#endif - -void makegrph_initialize(void); -void VRAMCALL makegrph(int page, int alldraw); - -#ifdef __cplusplus -} -#endif - + +enum { + GRPHXMAX = 80, + GRPHYMAX = 400 +}; + + +#ifdef __cplusplus +extern "C" { +#endif + +void makegrph_initialize(void); +void VRAMCALL makegrph(int page, int alldraw); + +#ifdef __cplusplus +} +#endif + diff --git a/vram/makegrph.mcr b/vram/makegrph.mcr old mode 100644 new mode 100755 index 8afe73be..0c0bfb08 --- a/vram/makegrph.mcr +++ b/vram/makegrph.mcr @@ -1,80 +1,80 @@ - -#ifdef __cplusplus -extern "C" { -#endif - -#if (!defined(MEMOPTIMIZE)) || (MEMOPTIMIZE == 0) - -extern UINT32 grph_table[4*256*2]; - -#define GRPHDATASET(d, a) { \ - UINT8 dat; \ - UINT32 l32, r32; \ - dat = mem[(a) + VRAM_B]; \ - l32 = grph_table[dat*2 + 0*0x200 + 0]; \ - r32 = grph_table[dat*2 + 0*0x200 + 1]; \ - dat = mem[(a) + VRAM_R]; \ - l32 += grph_table[dat*2 + 1*0x200 + 0]; \ - r32 += grph_table[dat*2 + 1*0x200 + 1]; \ - dat = mem[(a) + VRAM_G]; \ - l32 += grph_table[dat*2 + 2*0x200 + 0]; \ - r32 += grph_table[dat*2 + 2*0x200 + 1]; \ - dat = mem[(a) + VRAM_E]; \ - l32 += grph_table[dat*2 + 3*0x200 + 0]; \ - r32 += grph_table[dat*2 + 3*0x200 + 1]; \ - (d)[0] = l32; \ - (d)[1] = r32; \ -} - -#elif (MEMOPTIMIZE == 1) // for Mac - -extern UINT32 grph_table1[256*2]; - -#define GRPHDATASET(d, a) { \ - UINT8 dat; \ - UINT32 l32, r32; \ - dat = mem[(a) + VRAM_B]; \ - l32 = grph_table1[dat*2 + 0]; \ - r32 = grph_table1[dat*2 + 1]; \ - dat = mem[(a) + VRAM_R]; \ - l32 += grph_table1[dat*2 + 0] << 1; \ - r32 += grph_table1[dat*2 + 1] << 1; \ - dat = mem[(a) + VRAM_G]; \ - l32 += grph_table1[dat*2 + 0] << 2; \ - r32 += grph_table1[dat*2 + 1] << 2; \ - dat = mem[(a) + VRAM_E]; \ - l32 += grph_table1[dat*2 + 0] << 3; \ - r32 += grph_table1[dat*2 + 1] << 3; \ - (d)[0] = l32; \ - (d)[1] = r32; \ -} - -#else // for ARM - -extern UINT32 grph_table0[16]; - -#define GRPHDATASET(d, a) { \ - UINT8 dat; \ - UINT32 l32, r32; \ - dat = mem[(a) + VRAM_B]; \ - l32 = grph_table0[dat >> 4]; \ - r32 = grph_table0[dat & 15]; \ - dat = mem[(a) + VRAM_R]; \ - l32 += grph_table0[dat >> 4] << 1; \ - r32 += grph_table0[dat & 15] << 1; \ - dat = mem[(a) + VRAM_G]; \ - l32 += grph_table0[dat >> 4] << 2; \ - r32 += grph_table0[dat & 15] << 2; \ - dat = mem[(a) + VRAM_E]; \ - l32 += grph_table0[dat >> 4] << 3; \ - r32 += grph_table0[dat & 15] << 3; \ - (d)[0] = l32; \ - (d)[1] = r32; \ -} - -#endif - -#ifdef __cplusplus -} -#endif - + +#ifdef __cplusplus +extern "C" { +#endif + +#if (!defined(MEMOPTIMIZE)) || (MEMOPTIMIZE == 0) + +extern UINT32 grph_table[4*256*2]; + +#define GRPHDATASET(d, a) { \ + UINT8 dat; \ + UINT32 l32, r32; \ + dat = mem[(a) + VRAM_B]; \ + l32 = grph_table[dat*2 + 0*0x200 + 0]; \ + r32 = grph_table[dat*2 + 0*0x200 + 1]; \ + dat = mem[(a) + VRAM_R]; \ + l32 += grph_table[dat*2 + 1*0x200 + 0]; \ + r32 += grph_table[dat*2 + 1*0x200 + 1]; \ + dat = mem[(a) + VRAM_G]; \ + l32 += grph_table[dat*2 + 2*0x200 + 0]; \ + r32 += grph_table[dat*2 + 2*0x200 + 1]; \ + dat = mem[(a) + VRAM_E]; \ + l32 += grph_table[dat*2 + 3*0x200 + 0]; \ + r32 += grph_table[dat*2 + 3*0x200 + 1]; \ + (d)[0] = l32; \ + (d)[1] = r32; \ +} + +#elif (MEMOPTIMIZE == 1) // for Mac + +extern UINT32 grph_table1[256*2]; + +#define GRPHDATASET(d, a) { \ + UINT8 dat; \ + UINT32 l32, r32; \ + dat = mem[(a) + VRAM_B]; \ + l32 = grph_table1[dat*2 + 0]; \ + r32 = grph_table1[dat*2 + 1]; \ + dat = mem[(a) + VRAM_R]; \ + l32 += grph_table1[dat*2 + 0] << 1; \ + r32 += grph_table1[dat*2 + 1] << 1; \ + dat = mem[(a) + VRAM_G]; \ + l32 += grph_table1[dat*2 + 0] << 2; \ + r32 += grph_table1[dat*2 + 1] << 2; \ + dat = mem[(a) + VRAM_E]; \ + l32 += grph_table1[dat*2 + 0] << 3; \ + r32 += grph_table1[dat*2 + 1] << 3; \ + (d)[0] = l32; \ + (d)[1] = r32; \ +} + +#else // for ARM + +extern UINT32 grph_table0[16]; + +#define GRPHDATASET(d, a) { \ + UINT8 dat; \ + UINT32 l32, r32; \ + dat = mem[(a) + VRAM_B]; \ + l32 = grph_table0[dat >> 4]; \ + r32 = grph_table0[dat & 15]; \ + dat = mem[(a) + VRAM_R]; \ + l32 += grph_table0[dat >> 4] << 1; \ + r32 += grph_table0[dat & 15] << 1; \ + dat = mem[(a) + VRAM_G]; \ + l32 += grph_table0[dat >> 4] << 2; \ + r32 += grph_table0[dat & 15] << 2; \ + dat = mem[(a) + VRAM_E]; \ + l32 += grph_table0[dat >> 4] << 3; \ + r32 += grph_table0[dat & 15] << 3; \ + (d)[0] = l32; \ + (d)[1] = r32; \ +} + +#endif + +#ifdef __cplusplus +} +#endif + diff --git a/vram/maketext.c b/vram/maketext.c old mode 100644 new mode 100755 index f68f30a7..fd7ec3ca --- a/vram/maketext.c +++ b/vram/maketext.c @@ -1,757 +1,765 @@ -#include "compiler.h" -#include "cpucore.h" -#include "pccore.h" -#include "iocore.h" -#include "vram.h" -#include "scrndraw.h" -#include "dispsync.h" -#include "maketext.h" -#include "font/font.h" - - - TRAM_T tramflag; -static UINT32 text_table[512]; -static UINT32 text_tblx2[512][2]; - - -void maketext_initialize(void) { - - int i; - int j; - UINT8 bit; - - ZeroMemory(text_table, sizeof(text_table)); - for (i=0; i<8; i++) { - for (j=0; j<16; j++) { -#if defined(BYTESEX_LITTLE) - for (bit=1; bit<0x10; bit<<=1) -#elif defined(BYTESEX_BIG) - for (bit=8; bit; bit>>=1) -#endif - { - text_table[i*16+j] <<= 8; - text_table[i*16+j+128] <<= 8; - if (j & bit) { - text_table[i*16+j] |= (i+1) << 4; - } - else { - text_table[i*16+j+128] |= (i+1) << 4; - } - } - } - } - for (i=0; i<256; i++) { - text_table[i+256] = text_table[i ^ 0x80]; - } - for (i=0; i<512; i++) { -#if defined(BYTESEX_LITTLE) - text_tblx2[i][0] = (text_table[i] & 0x000000ff); - text_tblx2[i][0] |= (text_table[i] & 0x0000ffff) << 8; - text_tblx2[i][0] |= (text_table[i] & 0x0000ff00) << 16; - text_tblx2[i][1] = (text_table[i] & 0x00ff0000) >> 16; - text_tblx2[i][1] |= (text_table[i] & 0xffff0000) >> 8; - text_tblx2[i][1] |= (text_table[i] & 0xff000000); -#elif defined(BYTESEX_BIG) - text_tblx2[i][0] = (text_table[i] & 0xff000000); - text_tblx2[i][0] |= (text_table[i] & 0xffff0000) >> 8; - text_tblx2[i][0] |= (text_table[i] & 0x00ff0000) >> 16; - text_tblx2[i][1] = (text_table[i] & 0x0000ff00) << 16; - text_tblx2[i][1] |= (text_table[i] & 0x0000ffff) << 8; - text_tblx2[i][1] |= (text_table[i] & 0x000000ff); -#endif - } -} - -void maketext_reset(void) { - - ZeroMemory(&tramflag, sizeof(tramflag)); -} - -static UINT8 dirtyonblink(void) { - - UINT8 ret; - int i; - - ret = 0; - for (i=0; i<0x1000; i++) { - if (mem[0xa2000 + i*2] & TXTATR_BL) { - ret = 1; - tramupdate[i] |= 1; - } - } - return(ret); -} - -UINT8 maketext_curblink(void) { - - UINT8 ret; - UINT16 csrw; - - ret = 0; - if (tramflag.renewal & 1) { - tramflag.curdisp = tramflag.count & 1; - if (!(gdc.m.para[GDC_CSRFORM] & 0x80)) { - tramflag.curdisp = 0; - } - else if (gdc.m.para[GDC_CSRFORM+1] & 0x20) { - tramflag.curdisp = 1; - } - csrw = LOADINTELWORD(gdc.m.para + GDC_CSRW); - if ((tramflag.curdisp != tramflag.curdisplast) || - (tramflag.curpos != csrw)) { - if ((tramflag.curdisplast) && (tramflag.curpos < 0x1000)) { - tramupdate[tramflag.curpos] |= 1; - } - tramflag.curdisplast = tramflag.curdisp; - tramflag.curpos = csrw; - if ((tramflag.curdisplast) && (tramflag.curpos < 0x1000)) { - tramupdate[tramflag.curpos] |= 1; - } - ret = GDCSCRN_REDRAW; - } - } - if (tramflag.renewal & 2) { - tramflag.blinkdisp = ((tramflag.count & 3)?1:0); - if (tramflag.blink) { - tramflag.blink = dirtyonblink(); - if (tramflag.blink) { - ret = GDCSCRN_REDRAW; - } - } - } - tramflag.renewal = 0; - return(ret); -} - -void maketext(int text_renewal) { - - UINT8 multiple; - UINT8 TEXT_LR; - int TEXT_PL; - int TEXT_BL; - int TEXT_CL; - int TEXT_SUR; - int TEXT_SDR; - int topline; - int lines; - int nowline; - UINT8 wait2; - UINT pitch; - UINT csrw; - UINT esi; - UINT scroll; - int scrp; - UINT8 wait1; - UINT8 LRcnt; - BOOL reloadline; - int new_flag; - int cur_line; - int linecnt; - UINT8 *q; - UINT y; - UINT8 line_effect = 0; // for gcc - int x; - UINT32 bitmap[TEXTXMAX]; - UINT8 curx[TEXTXMAX+1]; - UINT16 color[TEXTXMAX]; - - if (text_renewal) { - tramflag.gaiji = 0; - } - - multiple = ((!(gdc.mode1 & 8)) && (!(gdc.crt15khz & 1)))?0x20:0x00; - TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f; - TEXT_PL = crtc.reg.pl; - TEXT_BL = crtc.reg.bl + 1; - TEXT_CL = crtc.reg.cl; - TEXT_SUR = crtc.reg.sur; - TEXT_SDR = -1; - if (TEXT_CL > 16) { - TEXT_CL = 16; - } - if (TEXT_PL >= 16) { - topline = TEXT_PL - 32; - lines = TEXT_BL; - } - else { - topline = TEXT_PL; - lines = TEXT_BL - topline; - if (lines <= 0) { - lines += 32; // •␳ - } - } - nowline = topline; - - wait2 = 0; - if (!TEXT_SUR) { - wait2 = crtc.reg.ssl; - TEXT_SDR = crtc.reg.sdr + 1; - } - else { - TEXT_SUR = 32 - TEXT_SUR; - } - - pitch = gdc.m.para[GDC_PITCH] & 0xfe; - csrw = LOADINTELWORD(gdc.m.para + GDC_CSRW); - esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL)); - scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2); - scroll = LOW14(scroll) >> 4; - scrp = 0; - - wait1 = 0; - LRcnt = 0; - reloadline = FALSE; - new_flag = 0; - cur_line = -1; - linecnt = 0; - q = np2_tram + dsync.textvad; - for (y=dsync.text_vbp; y> 1; - if (curx[x] & TXTATR_RV) { // text reverse - color[x] |= 0x80; - } - if (kanji2nd) { - kanji2nd = FALSE; - bitmap[x] = lastbitp + 0x800; - curx[x-1] |= 0x80; - curx[x] |= curx[x-1] & 0x20; - } - else if (!(mem[0xa0001 + edi*2] & gdc.bitac)) { - gaiji1st = 0; - if (gdc.mode1 & 8) { - bitmap[x] = 0x80000 + - (mem[0xa0000 + edi*2] << 4); - if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { - bitmap[x] += 0x1000; - } - } - else { - bitmap[x] = 0x82000 + - (mem[0xa0000 + edi*2] << 4); - curx[x] |= multiple; // ver0.74 - if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { - bitmap[x] += 8; - } - } - } - else { - UINT kc; - kc = LOADINTELWORD(mem + 0xa0000 + edi*2); - bitmap[x] = (kc & 0x7f7f) << 4; - kc &= 0x7f; // ver0.78 - if ((kc == 0x56) || (kc == 0x57)) { - tramflag.gaiji = 1; - if ((gaiji1st) && - (bitmap[x] == (lastbitp & (~15)))) { - curx[x-1] |= 0x80; - } - bitmap[x] += gaiji1st; - gaiji1st ^= 0x800; - } - else { - gaiji1st = 0; - if ((kc < 0x09) || (kc >= 0x0c)) { - kanji2nd = TRUE; - } - } - if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { - curx[x] |= 0x20; - bitmap[x] += 8; - } - else if (!(gdc.mode1 & 8)) { - curx[x] |= multiple; - } - } - lastbitp = bitmap[x]; - if (!(curx[x] & TXTATR_ST)) { - bitmap[x] = 0; - } - else if (curx[x] & TXTATR_BL) { - tramflag.blink = 1; - if (!tramflag.blinkdisp) { - bitmap[x] = 0; - } - } - edi = LOW12(edi + 1); - } - if (!tramflag.curdisp) { - cur_line = -1; - } - } - esi = LOW12(esi + pitch); - } - - if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) { - nowline = topline; - TEXT_SDR--; - wait1 = crtc.reg.ssl; - } - - if (!wait2) { - if (new_flag) { - renewal_line[y] |= 4; - if (cur_line >= 0) { - if ((nowline >= (gdc.m.para[GDC_CSRFORM+1] & 0x1f)) && - (nowline <= (gdc.m.para[GDC_CSRFORM+2] >> 3))) { - color[cur_line] |= 256; - if (curx[cur_line] & 0x80) { - color[cur_line+1] |= 256; - } - } - else { - color[cur_line] &= ~(256); - if (curx[cur_line] & 0x80) { - color[cur_line+1] &= ~(256); - } - } - } - if ((nowline >= 0) && (nowline < TEXT_CL)) { - // width80 - for (x=0; x>= 1; - } - data = fontrom[bitmap[x] + (fntline & 0x0f)]; - *(UINT32 *)(q+0) = text_table[color[x] + (data >> 4)]; - *(UINT32 *)(q+4) = text_table[color[x] + (data & 15)]; - q += 8; - } - } - else { - // width80 - for (x=0; x<(TEXTXMAX); x++) { - *(UINT32 *)(q+0) = text_table[color[x]]; - *(UINT32 *)(q+4) = text_table[color[x]]; - q += 8; - } - } - if ((line_effect & TXTATR_UL) && - ((nowline + 1) == lines)) { // ƒAƒ“ƒ_[ƒ‰ƒCƒ“ˆΚ’u - // width80 - q -= TEXTXMAX * 8; - q += 4; - for (x=0; x<(TEXTXMAX-1); x++) { - if (curx[x] & TXTATR_UL) { - *(UINT32 *)(q+0) = text_table[(color[x] & 0x70) - + 0x0f]; - *(UINT32 *)(q+4) = text_table[(color[x+1] & 0x70) - + 0x0f]; - } - q += 8; - } - if (curx[TEXTXMAX-1] & TXTATR_UL) { - *(UINT32 *)q = text_table[(color[TEXTXMAX-1] & 0x70) - + 0x0f]; - } - q += 4; - } - if ((line_effect & TXTATR_VL) && (!(gdc.mode1 & 1))) { - // width80 - q -= TEXTXMAX * 8; - for (x=0; x> 4; - reloadline = TRUE; - } - } - else { - wait2--; - } - - nowline++; - if ((TEXT_SDR) && (nowline >= lines)) { - nowline = topline; - TEXT_SDR--; - if (++linecnt == TEXT_SUR) { - wait2 = crtc.reg.ssl; - TEXT_SDR = crtc.reg.sdr + 1; - } - } - } - ZeroMemory(tramupdate, sizeof(tramupdate)); -} - -void maketext40(int text_renewal) { - - UINT8 multiple; - UINT8 TEXT_LR; - int TEXT_PL; - int TEXT_BL; - int TEXT_CL; - int TEXT_SUR; - int TEXT_SDR; - int topline; - int lines; - int nowline; - UINT8 wait2; - UINT pitch; - UINT csrw; - UINT esi; - UINT scroll; - int scrp; - UINT8 wait1; - UINT8 LRcnt; - BOOL reloadline; - int new_flag; - int cur_line; - int linecnt; - UINT8 *q; - UINT y; - UINT8 line_effect = 0; // for gcc - int x; - UINT32 bitmap[TEXTXMAX]; - UINT8 curx[TEXTXMAX+1]; - UINT16 color[TEXTXMAX]; - - if (text_renewal) { - tramflag.gaiji = 0; - } - - multiple = ((!(gdc.mode1 & 8)) && (!(gdc.crt15khz & 1)))?0x20:0x00; - TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f; - TEXT_PL = crtc.reg.pl; - TEXT_BL = crtc.reg.bl + 1; - TEXT_CL = crtc.reg.cl; - TEXT_SUR = crtc.reg.sur; - TEXT_SDR = -1; - if (TEXT_CL > 16) { - TEXT_CL = 16; - } - if (TEXT_PL >= 16) { - topline = TEXT_PL - 32; - lines = TEXT_BL; - } - else { - topline = TEXT_PL; - lines = TEXT_BL - topline; - if (lines <= 0) { - lines += 32; // •␳ - } - } - nowline = topline; - - wait2 = 0; - if (!TEXT_SUR) { - wait2 = crtc.reg.ssl; - TEXT_SDR = crtc.reg.sdr + 1; - } - else { - TEXT_SUR = 32 - TEXT_SUR; - } - - pitch = gdc.m.para[GDC_PITCH] & 0xfe; - csrw = LOADINTELWORD(gdc.m.para + GDC_CSRW); - esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL)); - scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2); - scroll = LOW14(scroll) >> 4; - scrp = 0; - - wait1 = 0; - LRcnt = 0; - reloadline = FALSE; - new_flag = 0; - cur_line = -1; - linecnt = 0; - q = np2_tram + dsync.textvad; - for (y=dsync.text_vbp; y> 1; - if (curx[x] & TXTATR_RV) { // text reverse - color[x] |= 0x80; - } - if (kanji2nd) { - kanji2nd = FALSE; - bitmap[x] = lastbitp + 0x800; - curx[x-1] |= 0x80; - curx[x] |= curx[x-1] & 0x20; - } - else if (!(mem[0xa0001 + edi*2] & gdc.bitac)) { - gaiji1st = 0; - if (gdc.mode1 & 8) { - bitmap[x] = 0x80000 + - (mem[0xa0000 + edi*2] << 4); - if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { - bitmap[x] += 0x1000; - } - } - else { - bitmap[x] = 0x82000 + - (mem[0xa0000 + edi*2] << 4); - curx[x] |= multiple; // ver0.74 - if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { - bitmap[x] += 8; - } - } - } - else { - UINT kc; - kc = LOADINTELWORD(mem + 0xa0000 + edi*2); - bitmap[x] = (kc & 0x7f7f) << 4; - kc &= 0x7f; // ver0.78 - if ((kc == 0x56) || (kc == 0x57)) { - tramflag.gaiji = 1; - if ((gaiji1st) && - (bitmap[x] == (lastbitp & (~15)))) { - curx[x-1] |= 0x80; - } - bitmap[x] += gaiji1st; - gaiji1st ^= 0x800; - } - else { - gaiji1st = 0; - if ((kc < 0x09) || (kc >= 0x0c)) { - kanji2nd = TRUE; - } - } - if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { - curx[x] |= 0x20; - bitmap[x] += 8; - } - else if (!(gdc.mode1 & 8)) { - curx[x] |= multiple; - } - } - lastbitp = bitmap[x]; - if (!(curx[x] & TXTATR_ST)) { - bitmap[x] = 0; - } - else if (curx[x] & TXTATR_BL) { - tramflag.blink = 1; - if (!tramflag.blinkdisp) { - bitmap[x] = 0; - } - } - edi = LOW12(edi + 2); // width40 - } - if (!tramflag.curdisp) { - cur_line = -1; - } - } - esi = LOW12(esi + pitch); - } - - if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) { - nowline = topline; - TEXT_SDR--; - wait1 = crtc.reg.ssl; - } - - if (!wait2) { - if (new_flag) { - renewal_line[y] |= 4; - if (cur_line >= 0) { - if ((nowline >= (gdc.m.para[GDC_CSRFORM+1] & 0x1f)) && - (nowline <= (gdc.m.para[GDC_CSRFORM+2] >> 3))) { - color[cur_line] |= 256; - if (curx[cur_line] & 0x80) { - color[cur_line+1] |= 256; - } - } - else { - color[cur_line] &= ~(256); - if (curx[cur_line] & 0x80) { - color[cur_line+1] &= ~(256); - } - } - } - if ((nowline >= 0) && (nowline < TEXT_CL)) { - // width40 - for (x=0; x<(TEXTXMAX/2); x++) { - int fntline; - UINT8 data; - fntline = nowline; - if (curx[x] & 0x20) { - fntline >>= 1; - } - data = fontrom[bitmap[x] + (fntline & 0x0f)]; - *(UINT32 *)(q+ 0) = text_tblx2[color[x] + - (data>>4)][0]; - *(UINT32 *)(q+ 4) = text_tblx2[color[x] + - (data>>4)][1]; - *(UINT32 *)(q+ 8) = text_tblx2[color[x] + - (data&0xf)][0]; - *(UINT32 *)(q+12) = text_tblx2[color[x] + - (data&0xf)][1]; - q += 16; - } - } - else { - // width40 - for (x=0; x<(TEXTXMAX/2); x++) { - *(UINT32 *)(q+ 0) = text_table[color[x]]; - *(UINT32 *)(q+ 4) = text_table[color[x]]; - *(UINT32 *)(q+ 8) = text_table[color[x]]; - *(UINT32 *)(q+12) = text_table[color[x]]; - q += 16; - } - } - if ((line_effect & TXTATR_UL) && - ((nowline + 1) == lines)) { // ƒAƒ“ƒ_[ƒ‰ƒCƒ“ˆΚ’u - // width40 - q -= TEXTXMAX * 8; - q += 4; - for (x=0; x<((TEXTXMAX/2)-1); x++) { - if (curx[x] & 8) { - *(UINT32 *)(q+ 0) = text_table[(color[x] & 0x70) - + 0x0f]; - *(UINT32 *)(q+ 4) = text_table[(color[x] & 0x70) - + 0x0f]; - *(UINT32 *)(q+ 8) = text_table[(color[x] & 0x70) - + 0x0f]; - *(UINT32 *)(q+12) = text_table[(color[x+1] & 0x70) - + 0x0f]; - } - q += 16; - } - if (curx[(TEXTXMAX/2)-1] & TXTATR_UL) { - *(UINT32 *)(q+0) = text_table[ - (color[TEXTXMAX-1] & 0x70) + 0x0f]; - *(UINT32 *)(q+4) = text_table[ - (color[TEXTXMAX-1] & 0x70) + 0x0f]; - *(UINT32 *)(q+8) = text_table[ - (color[TEXTXMAX-1] & 0x70) + 0x0f]; - } - q += 12; - } - if ((line_effect & TXTATR_VL) && (!(gdc.mode1 & 1))) { - // width40 - q -= TEXTXMAX * 8; - for (x=0; x<(TEXTXMAX/2); x++) { - if (curx[x] & TXTATR_VL) { - // text_table[] ‚π Žg‚Α‚Δ‚Θ‚’‚Μ‚Ε’ˆΣ - *(q+ 4) |= (color[x] & 0x70) + 0x10; - *(q+12) |= (color[x] & 0x70) + 0x10; - } - q += 16; - } - } - } - else { - q += TEXTXMAX * 8; - } - y++; - if (!(--scroll)) { - scrp = (scrp + 4) & 0x0c; - esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp)); - scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp + 2); - scroll = LOW14(scroll) >> 4; - reloadline = TRUE; - } - } - else { - wait2--; - } - - nowline++; - if ((TEXT_SDR) && (nowline >= lines)) { - nowline = topline; - TEXT_SDR--; - if (++linecnt == TEXT_SUR) { - wait2 = crtc.reg.ssl; - TEXT_SDR = crtc.reg.sdr + 1; - } - } - } - ZeroMemory(tramupdate, sizeof(tramupdate)); -} - +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + TRAM_T tramflag; +static UINT32 text_table[512]; +static UINT32 text_tblx2[512][2]; + + +void maketext_initialize(void) { + + int i; + int j; + UINT8 bit; + + ZeroMemory(text_table, sizeof(text_table)); + for (i=0; i<8; i++) { + for (j=0; j<16; j++) { +#if defined(BYTESEX_LITTLE) + for (bit=1; bit<0x10; bit<<=1) +#elif defined(BYTESEX_BIG) + for (bit=8; bit; bit>>=1) +#endif + { + text_table[i*16+j] <<= 8; + text_table[i*16+j+128] <<= 8; + if (j & bit) { + text_table[i*16+j] |= (i+1) << 4; + } + else { + text_table[i*16+j+128] |= (i+1) << 4; + } + } + } + } + for (i=0; i<256; i++) { + text_table[i+256] = text_table[i ^ 0x80]; + } + for (i=0; i<512; i++) { +#if defined(BYTESEX_LITTLE) + text_tblx2[i][0] = (text_table[i] & 0x000000ff); + text_tblx2[i][0] |= (text_table[i] & 0x0000ffff) << 8; + text_tblx2[i][0] |= (text_table[i] & 0x0000ff00) << 16; + text_tblx2[i][1] = (text_table[i] & 0x00ff0000) >> 16; + text_tblx2[i][1] |= (text_table[i] & 0xffff0000) >> 8; + text_tblx2[i][1] |= (text_table[i] & 0xff000000); +#elif defined(BYTESEX_BIG) + text_tblx2[i][0] = (text_table[i] & 0xff000000); + text_tblx2[i][0] |= (text_table[i] & 0xffff0000) >> 8; + text_tblx2[i][0] |= (text_table[i] & 0x00ff0000) >> 16; + text_tblx2[i][1] = (text_table[i] & 0x0000ff00) << 16; + text_tblx2[i][1] |= (text_table[i] & 0x0000ffff) << 8; + text_tblx2[i][1] |= (text_table[i] & 0x000000ff); +#endif + } +} + +void maketext_reset(void) { + + ZeroMemory(&tramflag, sizeof(tramflag)); +} + +static UINT8 dirtyonblink(void) { + + UINT8 ret; + int i; + + ret = 0; + for (i=0; i<0x1000; i++) { + if (mem[0xa2000 + i*2] & TXTATR_BL) { + ret = 1; + tramupdate[i] |= 1; + } + } + return(ret); +} + +UINT8 maketext_curblink(void) { + + UINT8 ret; + UINT16 csrw; + + ret = 0; + if (tramflag.renewal & 1) { + tramflag.curdisp = tramflag.count & 1; + if (!(gdc.m.para[GDC_CSRFORM] & 0x80)) { + tramflag.curdisp = 0; + } + else if (gdc.m.para[GDC_CSRFORM+1] & 0x20) { + tramflag.curdisp = 1; + } + csrw = LOADINTELWORD(gdc.m.para + GDC_CSRW); + if ((tramflag.curdisp != tramflag.curdisplast) || + (tramflag.curpos != csrw)) { + if ((tramflag.curdisplast) && (tramflag.curpos < 0x1000)) { + tramupdate[tramflag.curpos] |= 1; + } + tramflag.curdisplast = tramflag.curdisp; + tramflag.curpos = csrw; + if ((tramflag.curdisplast) && (tramflag.curpos < 0x1000)) { + tramupdate[tramflag.curpos] |= 1; + } + ret = GDCSCRN_REDRAW; + } + } + if (tramflag.renewal & 2) { + tramflag.blinkdisp = ((tramflag.count & 3)?1:0); + if (tramflag.blink) { + tramflag.blink = dirtyonblink(); + if (tramflag.blink) { + ret = GDCSCRN_REDRAW; + } + } + } + tramflag.renewal = 0; + return(ret); +} + +void maketext(int text_renewal) { + + UINT8 multiple; + UINT8 TEXT_LR; + int TEXT_PL; + int TEXT_BL; + int TEXT_CL; + int TEXT_SUR; + int TEXT_SDR; + int topline; + int lines; + int nowline; + UINT8 wait2; + UINT pitch; + UINT csrw; + UINT esi; + UINT scroll; + int scrp; + UINT8 wait1; + UINT8 LRcnt; + BOOL reloadline; + int new_flag; + int cur_line; + int linecnt; + UINT8 *q; + UINT y; + UINT8 line_effect = 0; // for gcc + int x; + UINT32 bitmap[TEXTXMAX]; + UINT8 curx[TEXTXMAX+1]; + UINT16 color[TEXTXMAX]; + + if (text_renewal) { + tramflag.gaiji = 0; + } + + multiple = ((!(gdc.mode1 & 8)) && (!(gdc.crt15khz & 1)))?0x20:0x00; + TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f; + TEXT_PL = crtc.reg.pl; + TEXT_BL = crtc.reg.bl + 1; + TEXT_CL = crtc.reg.cl; + TEXT_SUR = crtc.reg.sur; + TEXT_SDR = -1; + if (TEXT_CL > 16) { + TEXT_CL = 16; + } + if (TEXT_PL >= 16) { + topline = TEXT_PL - 32; + lines = TEXT_BL; + } + else { + topline = TEXT_PL; + lines = TEXT_BL - topline; + if (lines <= 0) { + lines += 32; // 補正 + } + } + nowline = topline; + + wait2 = 0; + if (!TEXT_SUR) { + wait2 = crtc.reg.ssl; + TEXT_SDR = crtc.reg.sdr + 1; + } + else { + TEXT_SUR = 32 - TEXT_SUR; + } + + pitch = gdc.m.para[GDC_PITCH] & 0xfe; + csrw = LOADINTELWORD(gdc.m.para + GDC_CSRW); + esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL)); + scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2); + scroll = LOW14(scroll) >> 4; + scrp = 0; + + wait1 = 0; + LRcnt = 0; + reloadline = FALSE; + new_flag = 0; + cur_line = -1; + linecnt = 0; + q = np2_tram + dsync.textvad; + for (y=dsync.text_vbp; y> 1; + if (curx[x] & TXTATR_RV) { // text reverse + color[x] |= 0x80; + } + if (kanji2nd) { + kanji2nd = FALSE; + bitmap[x] = lastbitp + 0x800; + curx[x-1] |= 0x80; + curx[x] |= curx[x-1] & 0x20; + } + else if (!(mem[0xa0001 + edi*2] & gdc.bitac)) { + gaiji1st = 0; + if (gdc.mode1 & 8) { + bitmap[x] = 0x80000 + + (mem[0xa0000 + edi*2] << 4); + if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { + bitmap[x] += 0x1000; + } + } + else { + bitmap[x] = 0x82000 + + (mem[0xa0000 + edi*2] << 4); + curx[x] |= multiple; // ver0.74 + if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { + bitmap[x] += 8; + } + } + } + else { + UINT kc; + kc = LOADINTELWORD(mem + 0xa0000 + edi*2); + bitmap[x] = (kc & 0x7f7f) << 4; + kc &= 0x7f; // ver0.78 + if ((kc == 0x56) || (kc == 0x57)) { + tramflag.gaiji = 1; + if ((gaiji1st) && + (bitmap[x] == (lastbitp & (~15)))) { + curx[x-1] |= 0x80; + } + bitmap[x] += gaiji1st; + gaiji1st ^= 0x800; + } + else { + gaiji1st = 0; + if ((kc < 0x09) || (kc >= 0x0c)) { + kanji2nd = TRUE; + } + } + if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { + curx[x] |= 0x20; + bitmap[x] += 8; + } + else if (!(gdc.mode1 & 8)) { + curx[x] |= multiple; + } + } + lastbitp = bitmap[x]; + if (!(curx[x] & TXTATR_ST)) { + bitmap[x] = 0; + } + else if (curx[x] & TXTATR_BL) { + tramflag.blink = 1; + if (!tramflag.blinkdisp) { + bitmap[x] = 0; + } + } + edi = LOW12(edi + 1); + } + if (!tramflag.curdisp) { + cur_line = -1; + } + } + esi = LOW12(esi + pitch); + } + + if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) { + nowline = topline; + TEXT_SDR--; + wait1 = crtc.reg.ssl; + } + + if (!wait2) { + if (new_flag) { + renewal_line[y] |= 4; + if (cur_line >= 0) { + if ((nowline >= (gdc.m.para[GDC_CSRFORM+1] & 0x1f)) && + (nowline <= (gdc.m.para[GDC_CSRFORM+2] >> 3))) { + color[cur_line] |= 256; + if (curx[cur_line] & 0x80) { + color[cur_line+1] |= 256; + } + } + else { + color[cur_line] &= ~(256); + if (curx[cur_line] & 0x80) { + color[cur_line+1] &= ~(256); + } + } + } + if ((nowline >= 0) && (nowline < TEXT_CL)) { + // width80 + for (x=0; x>= 1; + } + if(!fntline) { + hook_fontrom(bitmap[x] + (fntline & 0x0f)); + hf_codeul = 0; + } + data = fontrom[bitmap[x] + (fntline & 0x0f)]; + *(UINT32 *)(q+0) = text_table[color[x] + (data >> 4)]; + *(UINT32 *)(q+4) = text_table[color[x] + (data & 15)]; + q += 8; + } + } + else { + // width80 + for (x=0; x<(TEXTXMAX); x++) { + *(UINT32 *)(q+0) = text_table[color[x]]; + *(UINT32 *)(q+4) = text_table[color[x]]; + q += 8; + } + } + if ((line_effect & TXTATR_UL) && + ((nowline + 1) == lines)) { // γ‚’γƒ³γƒ€γƒΌγƒ©γ‚€γƒ³δ½η½ + // width80 + q -= TEXTXMAX * 8; + q += 4; + for (x=0; x<(TEXTXMAX-1); x++) { + if (curx[x] & TXTATR_UL) { + *(UINT32 *)(q+0) = text_table[(color[x] & 0x70) + + 0x0f]; + *(UINT32 *)(q+4) = text_table[(color[x+1] & 0x70) + + 0x0f]; + } + q += 8; + } + if (curx[TEXTXMAX-1] & TXTATR_UL) { + *(UINT32 *)q = text_table[(color[TEXTXMAX-1] & 0x70) + + 0x0f]; + } + q += 4; + } + if ((line_effect & TXTATR_VL) && (!(gdc.mode1 & 1))) { + // width80 + q -= TEXTXMAX * 8; + for (x=0; x> 4; + reloadline = TRUE; + } + } + else { + wait2--; + } + + nowline++; + if ((TEXT_SDR) && (nowline >= lines)) { + nowline = topline; + TEXT_SDR--; + if (++linecnt == TEXT_SUR) { + wait2 = crtc.reg.ssl; + TEXT_SDR = crtc.reg.sdr + 1; + } + } + } + ZeroMemory(tramupdate, sizeof(tramupdate)); +} + +void maketext40(int text_renewal) { + + UINT8 multiple; + UINT8 TEXT_LR; + int TEXT_PL; + int TEXT_BL; + int TEXT_CL; + int TEXT_SUR; + int TEXT_SDR; + int topline; + int lines; + int nowline; + UINT8 wait2; + UINT pitch; + UINT csrw; + UINT esi; + UINT scroll; + int scrp; + UINT8 wait1; + UINT8 LRcnt; + BOOL reloadline; + int new_flag; + int cur_line; + int linecnt; + UINT8 *q; + UINT y; + UINT8 line_effect = 0; // for gcc + int x; + UINT32 bitmap[TEXTXMAX]; + UINT8 curx[TEXTXMAX+1]; + UINT16 color[TEXTXMAX]; + + if (text_renewal) { + tramflag.gaiji = 0; + } + + multiple = ((!(gdc.mode1 & 8)) && (!(gdc.crt15khz & 1)))?0x20:0x00; + TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f; + TEXT_PL = crtc.reg.pl; + TEXT_BL = crtc.reg.bl + 1; + TEXT_CL = crtc.reg.cl; + TEXT_SUR = crtc.reg.sur; + TEXT_SDR = -1; + if (TEXT_CL > 16) { + TEXT_CL = 16; + } + if (TEXT_PL >= 16) { + topline = TEXT_PL - 32; + lines = TEXT_BL; + } + else { + topline = TEXT_PL; + lines = TEXT_BL - topline; + if (lines <= 0) { + lines += 32; // 補正 + } + } + nowline = topline; + + wait2 = 0; + if (!TEXT_SUR) { + wait2 = crtc.reg.ssl; + TEXT_SDR = crtc.reg.sdr + 1; + } + else { + TEXT_SUR = 32 - TEXT_SUR; + } + + pitch = gdc.m.para[GDC_PITCH] & 0xfe; + csrw = LOADINTELWORD(gdc.m.para + GDC_CSRW); + esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL)); + scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2); + scroll = LOW14(scroll) >> 4; + scrp = 0; + + wait1 = 0; + LRcnt = 0; + reloadline = FALSE; + new_flag = 0; + cur_line = -1; + linecnt = 0; + q = np2_tram + dsync.textvad; + for (y=dsync.text_vbp; y> 1; + if (curx[x] & TXTATR_RV) { // text reverse + color[x] |= 0x80; + } + if (kanji2nd) { + kanji2nd = FALSE; + bitmap[x] = lastbitp + 0x800; + curx[x-1] |= 0x80; + curx[x] |= curx[x-1] & 0x20; + } + else if (!(mem[0xa0001 + edi*2] & gdc.bitac)) { + gaiji1st = 0; + if (gdc.mode1 & 8) { + bitmap[x] = 0x80000 + + (mem[0xa0000 + edi*2] << 4); + if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { + bitmap[x] += 0x1000; + } + } + else { + bitmap[x] = 0x82000 + + (mem[0xa0000 + edi*2] << 4); + curx[x] |= multiple; // ver0.74 + if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { + bitmap[x] += 8; + } + } + } + else { + UINT kc; + kc = LOADINTELWORD(mem + 0xa0000 + edi*2); + bitmap[x] = (kc & 0x7f7f) << 4; + kc &= 0x7f; // ver0.78 + if ((kc == 0x56) || (kc == 0x57)) { + tramflag.gaiji = 1; + if ((gaiji1st) && + (bitmap[x] == (lastbitp & (~15)))) { + curx[x-1] |= 0x80; + } + bitmap[x] += gaiji1st; + gaiji1st ^= 0x800; + } + else { + gaiji1st = 0; + if ((kc < 0x09) || (kc >= 0x0c)) { + kanji2nd = TRUE; + } + } + if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { + curx[x] |= 0x20; + bitmap[x] += 8; + } + else if (!(gdc.mode1 & 8)) { + curx[x] |= multiple; + } + } + lastbitp = bitmap[x]; + if (!(curx[x] & TXTATR_ST)) { + bitmap[x] = 0; + } + else if (curx[x] & TXTATR_BL) { + tramflag.blink = 1; + if (!tramflag.blinkdisp) { + bitmap[x] = 0; + } + } + edi = LOW12(edi + 2); // width40 + } + if (!tramflag.curdisp) { + cur_line = -1; + } + } + esi = LOW12(esi + pitch); + } + + if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) { + nowline = topline; + TEXT_SDR--; + wait1 = crtc.reg.ssl; + } + + if (!wait2) { + if (new_flag) { + renewal_line[y] |= 4; + if (cur_line >= 0) { + if ((nowline >= (gdc.m.para[GDC_CSRFORM+1] & 0x1f)) && + (nowline <= (gdc.m.para[GDC_CSRFORM+2] >> 3))) { + color[cur_line] |= 256; + if (curx[cur_line] & 0x80) { + color[cur_line+1] |= 256; + } + } + else { + color[cur_line] &= ~(256); + if (curx[cur_line] & 0x80) { + color[cur_line+1] &= ~(256); + } + } + } + if ((nowline >= 0) && (nowline < TEXT_CL)) { + // width40 + for (x=0; x<(TEXTXMAX/2); x++) { + int fntline; + UINT8 data; + fntline = nowline; + if (curx[x] & 0x20) { + fntline >>= 1; + } + if(!fntline) { + hook_fontrom(bitmap[x] + (fntline & 0x0f)); + hf_codeul = 0; + } + data = fontrom[bitmap[x] + (fntline & 0x0f)]; + *(UINT32 *)(q+ 0) = text_tblx2[color[x] + + (data>>4)][0]; + *(UINT32 *)(q+ 4) = text_tblx2[color[x] + + (data>>4)][1]; + *(UINT32 *)(q+ 8) = text_tblx2[color[x] + + (data&0xf)][0]; + *(UINT32 *)(q+12) = text_tblx2[color[x] + + (data&0xf)][1]; + q += 16; + } + } + else { + // width40 + for (x=0; x<(TEXTXMAX/2); x++) { + *(UINT32 *)(q+ 0) = text_table[color[x]]; + *(UINT32 *)(q+ 4) = text_table[color[x]]; + *(UINT32 *)(q+ 8) = text_table[color[x]]; + *(UINT32 *)(q+12) = text_table[color[x]]; + q += 16; + } + } + if ((line_effect & TXTATR_UL) && + ((nowline + 1) == lines)) { // γ‚’γƒ³γƒ€γƒΌγƒ©γ‚€γƒ³δ½η½ + // width40 + q -= TEXTXMAX * 8; + q += 4; + for (x=0; x<((TEXTXMAX/2)-1); x++) { + if (curx[x] & 8) { + *(UINT32 *)(q+ 0) = text_table[(color[x] & 0x70) + + 0x0f]; + *(UINT32 *)(q+ 4) = text_table[(color[x] & 0x70) + + 0x0f]; + *(UINT32 *)(q+ 8) = text_table[(color[x] & 0x70) + + 0x0f]; + *(UINT32 *)(q+12) = text_table[(color[x+1] & 0x70) + + 0x0f]; + } + q += 16; + } + if (curx[(TEXTXMAX/2)-1] & TXTATR_UL) { + *(UINT32 *)(q+0) = text_table[ + (color[TEXTXMAX-1] & 0x70) + 0x0f]; + *(UINT32 *)(q+4) = text_table[ + (color[TEXTXMAX-1] & 0x70) + 0x0f]; + *(UINT32 *)(q+8) = text_table[ + (color[TEXTXMAX-1] & 0x70) + 0x0f]; + } + q += 12; + } + if ((line_effect & TXTATR_VL) && (!(gdc.mode1 & 1))) { + // width40 + q -= TEXTXMAX * 8; + for (x=0; x<(TEXTXMAX/2); x++) { + if (curx[x] & TXTATR_VL) { + // text_table[] γ‚’ 使ってγͺいγγ§ζ³¨ζ„ + *(q+ 4) |= (color[x] & 0x70) + 0x10; + *(q+12) |= (color[x] & 0x70) + 0x10; + } + q += 16; + } + } + } + else { + q += TEXTXMAX * 8; + } + y++; + if (!(--scroll)) { + scrp = (scrp + 4) & 0x0c; + esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp)); + scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp + 2); + scroll = LOW14(scroll) >> 4; + reloadline = TRUE; + } + } + else { + wait2--; + } + + nowline++; + if ((TEXT_SDR) && (nowline >= lines)) { + nowline = topline; + TEXT_SDR--; + if (++linecnt == TEXT_SUR) { + wait2 = crtc.reg.ssl; + TEXT_SDR = crtc.reg.sdr + 1; + } + } + } + ZeroMemory(tramupdate, sizeof(tramupdate)); +} + diff --git a/vram/maketext.h b/vram/maketext.h old mode 100644 new mode 100755 index 29257bf3..724d56bc --- a/vram/maketext.h +++ b/vram/maketext.h @@ -1,44 +1,44 @@ - -enum { - TEXTXMAX = 80, - TEXTYMAX = 400, - - TXTATR_ST = 0x01, // ~ƒV[ƒNƒŒƒbƒg - TXTATR_BL = 0x02, // ƒuƒŠƒ“ƒN - TXTATR_RV = 0x04, // ƒŠƒo[ƒX - TXTATR_UL = 0x08, // ƒAƒ“ƒ_[ƒ‰ƒCƒ“ - TXTATR_VL = 0x10, // ƒo[ƒ`ƒJƒ‹ƒ‰ƒCƒ“ - TXTATR_BG = 0x10, // ŠΘˆΥƒOƒ‰ƒt - TEXTATR_RGB = 0xe0 // ƒrƒbƒg•ΐ‚Ρ‚ΝGRB‚̏‡ -}; - -typedef struct { - UINT8 timing; - UINT8 count; - UINT8 renewal; - UINT8 gaiji; - UINT8 attr; - UINT8 curdisp; - UINT8 curdisplast; - UINT8 blink; - UINT8 blinkdisp; - UINT16 curpos; -} TRAM_T; - - -#ifdef __cplusplus -extern "C" { -#endif - -extern TRAM_T tramflag; - -void maketext_initialize(void); -void maketext_reset(void); -UINT8 maketext_curblink(void); -void maketext(int text_renewal); -void maketext40(int text_renewal); - -#ifdef __cplusplus -} -#endif - + +enum { + TEXTXMAX = 80, + TEXTYMAX = 400, + + TXTATR_ST = 0x01, // ~γ‚·γƒΌγ‚―γƒ¬γƒƒγƒˆ + TXTATR_BL = 0x02, // γƒ–γƒͺンク + TXTATR_RV = 0x04, // γƒͺバース + TXTATR_UL = 0x08, // をンダーラむン + TXTATR_VL = 0x10, // バーチカルラむン + TXTATR_BG = 0x10, // η°‘ζ˜“γ‚°γƒ©γƒ• + TEXTATR_RGB = 0xe0 // γƒ“γƒƒγƒˆδΈ¦γ³γ―GRBγι † +}; + +typedef struct { + UINT8 timing; + UINT8 count; + UINT8 renewal; + UINT8 gaiji; + UINT8 attr; + UINT8 curdisp; + UINT8 curdisplast; + UINT8 blink; + UINT8 blinkdisp; + UINT16 curpos; +} TRAM_T; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern TRAM_T tramflag; + +void maketext_initialize(void); +void maketext_reset(void); +UINT8 maketext_curblink(void); +void maketext(int text_renewal); +void maketext40(int text_renewal); + +#ifdef __cplusplus +} +#endif + diff --git a/vram/maketgrp.c b/vram/maketgrp.c old mode 100644 new mode 100755 index d1357d5b..cacb4270 --- a/vram/maketgrp.c +++ b/vram/maketgrp.c @@ -1,535 +1,535 @@ -#include "compiler.h" -#include "cpucore.h" -#include "pccore.h" -#include "iocore.h" -#include "vram.h" -#include "scrndraw.h" -#include "dispsync.h" -#include "palettes.h" -#include "maketext.h" -#include "maketgrp.h" -#include "makegrph.h" -#include "font/font.h" -#include "makegrph.mcr" - - -// extern int displaymoder; -#define displaymoder dsync.scrnxextend - - -void maketextgrph(int plane, int text_renewal, int grph_renewal) { - - UINT8 TEXT_LR; - int TEXT_PL; - int TEXT_BL; - int TEXT_CL; - int TEXT_SUR; - int TEXT_SDR; - int topline; - int lines; - int nowline; - UINT8 wait2; - UINT m_pitch; - UINT esi; - UINT m_scr; - int m_scrp; - UINT s_pitch; - UINT ebp; - UINT s_scr; - int s_scrp; - int s_scrpmask; - UINT8 GRPH_LR; - UINT8 GRPH_LRcnt; - UINT32 ppage; - UINT32 gbit; - UINT ymax; - UINT8 *q; - UINT8 wait1; - UINT8 TEXT_LRcnt; - BOOL reloadline; - int new_flag; - int linecnt; - UINT y; - UINT edi; - UINT x; - int i; - UINT8 color[TEXTXMAX]; - UINT32 bit[160]; - - TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f; - TEXT_PL = crtc.reg.pl; - TEXT_BL = crtc.reg.bl + 1; - TEXT_CL = crtc.reg.cl; - TEXT_SUR = crtc.reg.sur; - TEXT_SDR = -1; - if (TEXT_CL > 16) { - TEXT_CL = 16; - } - if (TEXT_PL >= 16) { - topline = TEXT_PL - 32; - lines = TEXT_BL; - } - else { - topline = TEXT_PL; - lines = TEXT_BL - topline; - if (lines <= 0) { - lines += 32; - } - } - nowline = topline; - - wait2 = 0; - if (!TEXT_SUR) { - wait2 = crtc.reg.ssl; - TEXT_SDR = crtc.reg.sdr + 1; - } - else { - TEXT_SUR = 32 - TEXT_SUR; - } - - m_pitch = gdc.m.para[GDC_PITCH] & 0xfe; - esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL)); - m_scr = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2); - m_scr = LOW14(m_scr) >> 4; - m_scrp = 0; - - s_pitch = gdc.s.para[GDC_PITCH]; - if (!(gdc.clock & 0x80)) { - s_pitch <<= 1; - } - s_pitch &= 0xfe; - ebp = LOADINTELWORD(gdc.s.para + GDC_SCROLL); - ebp = LOW15(ebp << 1); - s_scr = LOADINTELWORD(gdc.s.para + GDC_SCROLL + 2); - s_scr = LOW14(s_scr) >> 4; - s_scrp = 0; - s_scrpmask = (np2cfg.uPD72020)?0x4:0xc; - - GRPH_LR = gdc.s.para[GDC_CSRFORM] & 0x1f; - GRPH_LRcnt = GRPH_LR; - - // ƒOƒ‰ƒt‚̂ف[‚ͺγc - if (dsync.text_vbp > dsync.grph_vbp) { - UINT remain; - remain = dsync.text_vbp - dsync.grph_vbp; - do { - if (!GRPH_LRcnt) { - GRPH_LRcnt = GRPH_LR; - s_scr--; - if (!s_scr) { - s_scrp = (s_scrp + 4) & s_scrpmask; - ebp = LOADINTELWORD(gdc.s.para + GDC_SCROLL + s_scrp); - ebp = LOW15(ebp << 1); - s_scr = LOADINTELWORD(gdc.s.para + GDC_SCROLL + - s_scrp + 2); - s_scr = LOW14(s_scr) >> 4; - } - else { - ebp = LOW15(ebp + s_pitch); - } - } - else { - GRPH_LRcnt--; - } - } while(--remain); - } - - ppage = (plane)?VRAM_STEP:0; - gbit = 0x01010101 << plane; - ymax = min(dsync.textymax, dsync.grphymax); - q = np2_vram[plane] + dsync.textvad; - wait1 = 0; - TEXT_LRcnt = 0; - reloadline = FALSE; - new_flag = 0; - linecnt = 0; - for (y=dsync.text_vbp; y> 5; - edi = LOW12(edi + 1); // width80 - } - esi = LOW12(esi + m_pitch); - } - - if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) { - nowline = topline; - TEXT_SDR--; - wait1 = crtc.reg.ssl; - } - - if (!wait2) { - int grph_new; - grph_new = 0; - if (y >= dsync.grph_vbp) { - grph_new = new_flag | grph_renewal; - if (!grph_new) { - UINT vc = ebp; - for (x=0; x> 4; - reloadline = TRUE; - } - if (!GRPH_LRcnt) { - GRPH_LRcnt = GRPH_LR; - s_scr--; - if (!s_scr) { - s_scrp = (s_scrp + 4) & s_scrpmask; - ebp = LOADINTELWORD(gdc.s.para + GDC_SCROLL + s_scrp); - ebp = LOW15(ebp << 1); - s_scr = LOADINTELWORD(gdc.s.para + GDC_SCROLL + - s_scrp + 2); - s_scr = LOW14(s_scr) >> 4; - } - else { - ebp = LOW15(ebp + s_pitch); - } - } - else { - GRPH_LRcnt--; - } - } - else { - wait2--; - } - - nowline++; - if ((TEXT_SDR) && (nowline >= lines)) { - nowline = topline; - TEXT_SDR--; - if (++linecnt == TEXT_SUR) { - wait2 = crtc.reg.ssl; - TEXT_SDR = crtc.reg.sdr + 1; - } - } - } - - gbit = ~gbit; - for (i=0; i<0x8000; i+=4) { - *(UINT32 *)(vramupdate + i) &= gbit; - } -} - -void maketextgrph40(int plane, int text_renewal, int grph_renewal) { - - UINT8 TEXT_LR; - int TEXT_PL; - int TEXT_BL; - int TEXT_CL; - int TEXT_SUR; - int TEXT_SDR; - int topline; - int lines; - int nowline = 0; - UINT8 wait2 = 0; - UINT m_pitch; - UINT esi; - UINT m_scr; - int m_scrp; - UINT s_pitch; - UINT ebp; - UINT s_scr; - int s_scrp; - int s_scrpmask; - UINT8 GRPH_LR; - UINT8 GRPH_LRcnt; - UINT32 ppage; - UINT32 gbit; - UINT ymax; - UINT8 *q; - UINT8 wait1; - UINT8 TEXT_LRcnt; - BOOL reloadline; - int new_flag; - int linecnt; - UINT y; - UINT edi; - UINT x; - int i; - UINT8 color[TEXTXMAX]; - UINT32 bit[160]; - - TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f; - TEXT_PL = crtc.reg.pl; - TEXT_BL = crtc.reg.bl + 1; - TEXT_CL = crtc.reg.cl; - TEXT_SUR = crtc.reg.sur; - TEXT_SDR = -1; - if (TEXT_CL > 16) { - TEXT_CL = 16; - } - if (TEXT_PL >= 16) { - topline = TEXT_PL - 32; - lines = TEXT_BL; - } - else { - topline = TEXT_PL; - lines = TEXT_BL - topline; - if (lines <= 0) { - lines += 32; - } - } - nowline = topline; - - wait2 = 0; - if (!TEXT_SUR) { - wait2 = crtc.reg.ssl; - TEXT_SDR = crtc.reg.sdr + 1; - } - else { - TEXT_SUR = 32 - TEXT_SUR; - } - - m_pitch = gdc.m.para[GDC_PITCH] & 0xfe; - esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL)); - m_scr = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2); - m_scr = LOW14(m_scr) >> 4; - m_scrp = 0; - - s_pitch = gdc.s.para[GDC_PITCH]; - if (!(gdc.clock & 0x80)) { - s_pitch <<= 1; - } - s_pitch &= 0xfe; - ebp = LOADINTELWORD(gdc.s.para + GDC_SCROLL); - ebp = LOW15(ebp << 1); - s_scr = LOADINTELWORD(gdc.s.para + GDC_SCROLL + 2); - s_scr = LOW14(s_scr) >> 4; - s_scrp = 0; - s_scrpmask = (np2cfg.uPD72020)?0x4:0xc; - - GRPH_LR = gdc.s.para[GDC_CSRFORM] & 0x1f; - GRPH_LRcnt = GRPH_LR; - - // ƒOƒ‰ƒt‚̂ف[‚ͺγc - if (dsync.text_vbp > dsync.grph_vbp) { - UINT remain; - remain = dsync.text_vbp - dsync.grph_vbp; - do { - if (!GRPH_LRcnt) { - GRPH_LRcnt = GRPH_LR; - s_scr--; - if (!s_scr) { - s_scrp = (s_scrp + 4) & s_scrpmask; - ebp = LOADINTELWORD(gdc.s.para + GDC_SCROLL + s_scrp); - ebp = LOW15(ebp << 1); - s_scr = LOADINTELWORD(gdc.s.para + GDC_SCROLL + - s_scrp + 2); - s_scr = LOW14(s_scr) >> 4; - } - else { - ebp = LOW15(ebp + s_pitch); - } - } - else { - GRPH_LRcnt--; - } - } while(--remain); - } - - ppage = (plane)?VRAM_STEP:0; - gbit = 0x01010101 << plane; - ymax = min(dsync.textymax, dsync.grphymax); - q = np2_vram[plane] + dsync.textvad; - wait1 = 0; - TEXT_LRcnt = 0; - reloadline = FALSE; - new_flag = 0; - linecnt = 0; - for (y=dsync.text_vbp; y> 5; - edi = LOW12(edi + 2); // width40 - } - esi = LOW12(esi + m_pitch); - } - - if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) { - nowline = topline; - TEXT_SDR--; - wait1 = crtc.reg.ssl; - } - - if (!wait2) { - int grph_new; - grph_new = 0; - if (y >= dsync.grph_vbp) { - grph_new = new_flag | grph_renewal; - if (!grph_new) { - UINT vc = ebp; - for (x=0; x> 4; - reloadline = TRUE; - } - if (!GRPH_LRcnt) { - GRPH_LRcnt = GRPH_LR; - s_scr--; - if (!s_scr) { - s_scrp = (s_scrp + 4) & s_scrpmask; - ebp = LOADINTELWORD(gdc.s.para + GDC_SCROLL + s_scrp); - ebp = LOW15(ebp << 1); - s_scr = LOADINTELWORD(gdc.s.para + GDC_SCROLL + - s_scrp + 2); - s_scr = LOW14(s_scr) >> 4; - } - else { - ebp = LOW15(ebp + s_pitch); - } - } - else { - GRPH_LRcnt--; - } - } - else { - wait2--; - } - - nowline++; - if ((TEXT_SDR) && (nowline >= lines)) { - nowline = topline; - TEXT_SDR--; - if (++linecnt == TEXT_SUR) { - wait2 = crtc.reg.ssl; - TEXT_SDR = crtc.reg.sdr + 1; - } - } - } - - gbit = ~gbit; - for (i=0; i<0x8000; i+=4) { - *(UINT32 *)(vramupdate + i) &= gbit; - } -} - +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "makegrph.mcr" + + +// extern int displaymoder; +#define displaymoder dsync.scrnxextend + + +void maketextgrph(int plane, int text_renewal, int grph_renewal) { + + UINT8 TEXT_LR; + int TEXT_PL; + int TEXT_BL; + int TEXT_CL; + int TEXT_SUR; + int TEXT_SDR; + int topline; + int lines; + int nowline; + UINT8 wait2; + UINT m_pitch; + UINT esi; + UINT m_scr; + int m_scrp; + UINT s_pitch; + UINT ebp; + UINT s_scr; + int s_scrp; + int s_scrpmask; + UINT8 GRPH_LR; + UINT8 GRPH_LRcnt; + UINT32 ppage; + UINT32 gbit; + UINT ymax; + UINT8 *q; + UINT8 wait1; + UINT8 TEXT_LRcnt; + BOOL reloadline; + int new_flag; + int linecnt; + UINT y; + UINT edi; + UINT x; + int i; + UINT8 color[TEXTXMAX]; + UINT32 bit[160]; + + TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f; + TEXT_PL = crtc.reg.pl; + TEXT_BL = crtc.reg.bl + 1; + TEXT_CL = crtc.reg.cl; + TEXT_SUR = crtc.reg.sur; + TEXT_SDR = -1; + if (TEXT_CL > 16) { + TEXT_CL = 16; + } + if (TEXT_PL >= 16) { + topline = TEXT_PL - 32; + lines = TEXT_BL; + } + else { + topline = TEXT_PL; + lines = TEXT_BL - topline; + if (lines <= 0) { + lines += 32; + } + } + nowline = topline; + + wait2 = 0; + if (!TEXT_SUR) { + wait2 = crtc.reg.ssl; + TEXT_SDR = crtc.reg.sdr + 1; + } + else { + TEXT_SUR = 32 - TEXT_SUR; + } + + m_pitch = gdc.m.para[GDC_PITCH] & 0xfe; + esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL)); + m_scr = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2); + m_scr = LOW14(m_scr) >> 4; + m_scrp = 0; + + s_pitch = gdc.s.para[GDC_PITCH]; + if (!(gdc.clock & 0x80)) { + s_pitch <<= 1; + } + s_pitch &= 0xfe; + ebp = LOADINTELWORD(gdc.s.para + GDC_SCROLL); + ebp = LOW15(ebp << 1); + s_scr = LOADINTELWORD(gdc.s.para + GDC_SCROLL + 2); + s_scr = LOW14(s_scr) >> 4; + s_scrp = 0; + s_scrpmask = (np2cfg.uPD72020)?0x4:0xc; + + GRPH_LR = gdc.s.para[GDC_CSRFORM] & 0x1f; + GRPH_LRcnt = GRPH_LR; + + // グラフγγ»γƒΌγŒδΈŠβ€¦ + if (dsync.text_vbp > dsync.grph_vbp) { + UINT remain; + remain = dsync.text_vbp - dsync.grph_vbp; + do { + if (!GRPH_LRcnt) { + GRPH_LRcnt = GRPH_LR; + s_scr--; + if (!s_scr) { + s_scrp = (s_scrp + 4) & s_scrpmask; + ebp = LOADINTELWORD(gdc.s.para + GDC_SCROLL + s_scrp); + ebp = LOW15(ebp << 1); + s_scr = LOADINTELWORD(gdc.s.para + GDC_SCROLL + + s_scrp + 2); + s_scr = LOW14(s_scr) >> 4; + } + else { + ebp = LOW15(ebp + s_pitch); + } + } + else { + GRPH_LRcnt--; + } + } while(--remain); + } + + ppage = (plane)?VRAM_STEP:0; + gbit = 0x01010101 << plane; + ymax = MIN(dsync.textymax, dsync.grphymax); + q = np2_vram[plane] + dsync.textvad; + wait1 = 0; + TEXT_LRcnt = 0; + reloadline = FALSE; + new_flag = 0; + linecnt = 0; + for (y=dsync.text_vbp; y> 5; + edi = LOW12(edi + 1); // width80 + } + esi = LOW12(esi + m_pitch); + } + + if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) { + nowline = topline; + TEXT_SDR--; + wait1 = crtc.reg.ssl; + } + + if (!wait2) { + int grph_new; + grph_new = 0; + if (y >= dsync.grph_vbp) { + grph_new = new_flag | grph_renewal; + if (!grph_new) { + UINT vc = ebp; + for (x=0; x> 4; + reloadline = TRUE; + } + if (!GRPH_LRcnt) { + GRPH_LRcnt = GRPH_LR; + s_scr--; + if (!s_scr) { + s_scrp = (s_scrp + 4) & s_scrpmask; + ebp = LOADINTELWORD(gdc.s.para + GDC_SCROLL + s_scrp); + ebp = LOW15(ebp << 1); + s_scr = LOADINTELWORD(gdc.s.para + GDC_SCROLL + + s_scrp + 2); + s_scr = LOW14(s_scr) >> 4; + } + else { + ebp = LOW15(ebp + s_pitch); + } + } + else { + GRPH_LRcnt--; + } + } + else { + wait2--; + } + + nowline++; + if ((TEXT_SDR) && (nowline >= lines)) { + nowline = topline; + TEXT_SDR--; + if (++linecnt == TEXT_SUR) { + wait2 = crtc.reg.ssl; + TEXT_SDR = crtc.reg.sdr + 1; + } + } + } + + gbit = ~gbit; + for (i=0; i<0x8000; i+=4) { + *(UINT32 *)(vramupdate + i) &= gbit; + } +} + +void maketextgrph40(int plane, int text_renewal, int grph_renewal) { + + UINT8 TEXT_LR; + int TEXT_PL; + int TEXT_BL; + int TEXT_CL; + int TEXT_SUR; + int TEXT_SDR; + int topline; + int lines; + int nowline = 0; + UINT8 wait2 = 0; + UINT m_pitch; + UINT esi; + UINT m_scr; + int m_scrp; + UINT s_pitch; + UINT ebp; + UINT s_scr; + int s_scrp; + int s_scrpmask; + UINT8 GRPH_LR; + UINT8 GRPH_LRcnt; + UINT32 ppage; + UINT32 gbit; + UINT ymax; + UINT8 *q; + UINT8 wait1; + UINT8 TEXT_LRcnt; + BOOL reloadline; + int new_flag; + int linecnt; + UINT y; + UINT edi; + UINT x; + int i; + UINT8 color[TEXTXMAX]; + UINT32 bit[160]; + + TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f; + TEXT_PL = crtc.reg.pl; + TEXT_BL = crtc.reg.bl + 1; + TEXT_CL = crtc.reg.cl; + TEXT_SUR = crtc.reg.sur; + TEXT_SDR = -1; + if (TEXT_CL > 16) { + TEXT_CL = 16; + } + if (TEXT_PL >= 16) { + topline = TEXT_PL - 32; + lines = TEXT_BL; + } + else { + topline = TEXT_PL; + lines = TEXT_BL - topline; + if (lines <= 0) { + lines += 32; + } + } + nowline = topline; + + wait2 = 0; + if (!TEXT_SUR) { + wait2 = crtc.reg.ssl; + TEXT_SDR = crtc.reg.sdr + 1; + } + else { + TEXT_SUR = 32 - TEXT_SUR; + } + + m_pitch = gdc.m.para[GDC_PITCH] & 0xfe; + esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL)); + m_scr = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2); + m_scr = LOW14(m_scr) >> 4; + m_scrp = 0; + + s_pitch = gdc.s.para[GDC_PITCH]; + if (!(gdc.clock & 0x80)) { + s_pitch <<= 1; + } + s_pitch &= 0xfe; + ebp = LOADINTELWORD(gdc.s.para + GDC_SCROLL); + ebp = LOW15(ebp << 1); + s_scr = LOADINTELWORD(gdc.s.para + GDC_SCROLL + 2); + s_scr = LOW14(s_scr) >> 4; + s_scrp = 0; + s_scrpmask = (np2cfg.uPD72020)?0x4:0xc; + + GRPH_LR = gdc.s.para[GDC_CSRFORM] & 0x1f; + GRPH_LRcnt = GRPH_LR; + + // グラフγγ»γƒΌγŒδΈŠβ€¦ + if (dsync.text_vbp > dsync.grph_vbp) { + UINT remain; + remain = dsync.text_vbp - dsync.grph_vbp; + do { + if (!GRPH_LRcnt) { + GRPH_LRcnt = GRPH_LR; + s_scr--; + if (!s_scr) { + s_scrp = (s_scrp + 4) & s_scrpmask; + ebp = LOADINTELWORD(gdc.s.para + GDC_SCROLL + s_scrp); + ebp = LOW15(ebp << 1); + s_scr = LOADINTELWORD(gdc.s.para + GDC_SCROLL + + s_scrp + 2); + s_scr = LOW14(s_scr) >> 4; + } + else { + ebp = LOW15(ebp + s_pitch); + } + } + else { + GRPH_LRcnt--; + } + } while(--remain); + } + + ppage = (plane)?VRAM_STEP:0; + gbit = 0x01010101 << plane; + ymax = MIN(dsync.textymax, dsync.grphymax); + q = np2_vram[plane] + dsync.textvad; + wait1 = 0; + TEXT_LRcnt = 0; + reloadline = FALSE; + new_flag = 0; + linecnt = 0; + for (y=dsync.text_vbp; y> 5; + edi = LOW12(edi + 2); // width40 + } + esi = LOW12(esi + m_pitch); + } + + if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) { + nowline = topline; + TEXT_SDR--; + wait1 = crtc.reg.ssl; + } + + if (!wait2) { + int grph_new; + grph_new = 0; + if (y >= dsync.grph_vbp) { + grph_new = new_flag | grph_renewal; + if (!grph_new) { + UINT vc = ebp; + for (x=0; x> 4; + reloadline = TRUE; + } + if (!GRPH_LRcnt) { + GRPH_LRcnt = GRPH_LR; + s_scr--; + if (!s_scr) { + s_scrp = (s_scrp + 4) & s_scrpmask; + ebp = LOADINTELWORD(gdc.s.para + GDC_SCROLL + s_scrp); + ebp = LOW15(ebp << 1); + s_scr = LOADINTELWORD(gdc.s.para + GDC_SCROLL + + s_scrp + 2); + s_scr = LOW14(s_scr) >> 4; + } + else { + ebp = LOW15(ebp + s_pitch); + } + } + else { + GRPH_LRcnt--; + } + } + else { + wait2--; + } + + nowline++; + if ((TEXT_SDR) && (nowline >= lines)) { + nowline = topline; + TEXT_SDR--; + if (++linecnt == TEXT_SUR) { + wait2 = crtc.reg.ssl; + TEXT_SDR = crtc.reg.sdr + 1; + } + } + } + + gbit = ~gbit; + for (i=0; i<0x8000; i+=4) { + *(UINT32 *)(vramupdate + i) &= gbit; + } +} + diff --git a/vram/maketgrp.h b/vram/maketgrp.h old mode 100644 new mode 100755 index 4e1afa48..481c62e9 --- a/vram/maketgrp.h +++ b/vram/maketgrp.h @@ -1,12 +1,12 @@ - -#ifdef __cplusplus -extern "C" { -#endif - -void maketextgrph(int plane, int text_renewal, int grph_renewal); -void maketextgrph40(int plane, int text_renewal, int grph_renewal); - -#ifdef __cplusplus -} -#endif - + +#ifdef __cplusplus +extern "C" { +#endif + +void maketextgrph(int plane, int text_renewal, int grph_renewal); +void maketextgrph40(int plane, int text_renewal, int grph_renewal); + +#ifdef __cplusplus +} +#endif + diff --git a/vram/palettes.c b/vram/palettes.c old mode 100644 new mode 100755 index 8e21ac7b..ba54ac1d --- a/vram/palettes.c +++ b/vram/palettes.c @@ -1,557 +1,557 @@ -#include "compiler.h" -#include "scrnmng.h" -#include "pccore.h" -#include "iocore.h" -#include "scrndraw.h" -#include "palettes.h" - - RGB32 np2_pal32[NP2PAL_MAX]; -#if defined(SUPPORT_16BPP) - RGB16 np2_pal16[NP2PAL_MAX]; -#endif - - PALEVENT palevent; -static RGB32 degpal1[8]; -static RGB32 degpal2[8]; -static UINT8 anapal1[16]; -static UINT8 anapal2[16]; - -static RGB32 lcdpal[15]; -static UINT8 lcdtbl[0x1000]; - UINT8 pal_monotable[16] = {0, 0, 0, 0, 1, 1, 1, 1, - 0, 0, 0, 0, 1, 1, 1, 1}; - -static const UINT8 lcdpal_a[27] = { 0, 1, 2, 3, 5, 2, 4, 4, 6, - 7, 9, 2,11,13, 2, 4, 4, 6, - 8, 8,10, 8, 8,10,12,12,14}; -static const UINT8 deftbl[4] = {0x04, 0x15, 0x26, 0x37}; - - -void pal_makegrad(RGB32 *pal, int pals, UINT32 bg, UINT32 fg) { - - int i; - - if (pals >= 2) { - pals--; - for (i=0; i<=pals; i++) { - pal[i].p.b = (UINT8) - ((((fg >> 0) & 0x0000ff) * i + - ((bg >> 0) & 0x0000ff) * (pals-i)) / pals); - pal[i].p.g = (UINT8) - ((((fg >> 8) & 0x0000ff) * i + - ((bg >> 8) & 0x0000ff) * (pals-i)) / pals); - pal[i].p.r = (UINT8) - ((((fg >> 16) & 0x0000ff) * i + - ((bg >> 16) & 0x0000ff) * (pals-i)) / pals); - pal[i].p.e = 0; - } - } -} - - -// ---- - -void pal_initlcdtable(void) { - - UINT i; - int j; - - for (i=0; i<0x1000; i++) { - j = 0; - if ((i & 0x00f) >= 0x004) { // b - j++; - if ((i & 0x00f) >= 0x00b) { - j++; - } - } - if ((i & 0x0f0) >= 0x040) { // r - j += 3; - if ((i & 0x0f0) >= 0x0b0) { - j += 3; - } - } - if ((i & 0xf00) >= 0x400) { // g - j += 9; - if ((i & 0xf00) >= 0xb00) { - j += 9; - } - } - lcdtbl[i] = lcdpal_a[j]; - } -} - -void pal_makelcdpal(void) { - - if (!(np2cfg.LCD_MODE & 2)) { - pal_makegrad(lcdpal, 15, np2cfg.BG_COLOR, np2cfg.FG_COLOR); - } - else { - pal_makegrad(lcdpal, 15, np2cfg.FG_COLOR, np2cfg.BG_COLOR); - } -} - -void pal_makeskiptable(void) { - - int i; - RGB32 pal; - UINT8 ana; - - for (i=0; i<8; i++) { - pal.p.b = (UINT8)(i & 1); - pal.p.r = (UINT8)((i >> 1) & 1); - pal.p.g = (UINT8)((i >> 2) & 1); - pal.p.e = 0; - degpal1[i].d = pal.d * 255; - degpal2[i].d = pal.d * np2cfg.skiplight; - } - for (i=0; i<16; i++) { - ana = (UINT8)(i * 0x11); - anapal1[i] = ana; - anapal2[i] = (UINT8)((np2cfg.skiplight * anapal1[i]) / 255); - } -} - - -// --------------------------------------------------------------------------- - -void pal_makeanalog(RGB32 *pal, UINT16 bit) { - - UINT i; - - for (i=0; ip.b & 15]; - np2_pal32[i+NP2PAL_GRPH].p.g = anapal1[pal->p.g & 15]; - np2_pal32[i+NP2PAL_GRPH].p.r = anapal1[pal->p.r & 15]; - if (np2cfg.skipline) { - np2_pal32[i+NP2PAL_SKIP].p.b = anapal2[pal->p.b & 15]; - np2_pal32[i+NP2PAL_SKIP].p.g = anapal2[pal->p.g & 15]; - np2_pal32[i+NP2PAL_SKIP].p.r = anapal2[pal->p.r & 15]; - } - } - } -#if defined(SUPPORT_16BPP) - if (scrnmng_getbpp() == 16) { - for (i=0; i> 4) & 7].d; - np2_pal32[i+NP2PAL_GRPH+ 4].d = - np2_pal32[i+NP2PAL_GRPH+12].d = - degpal1[paltbl[i] & 7].d; - if (np2cfg.skipline) { - np2_pal32[i+NP2PAL_SKIP+ 0].d = - np2_pal32[i+NP2PAL_SKIP+ 8].d = - degpal2[(paltbl[i] >> 4) & 7].d; - np2_pal32[i+NP2PAL_SKIP+ 4].d = - np2_pal32[i+NP2PAL_SKIP+12].d = - degpal2[paltbl[i] & 7].d; - } - } -#if defined(SUPPORT_16BPP) - if (scrnmng_getbpp() == 16) { - for (i=0; i<4; i++) { - np2_pal16[i+NP2PAL_GRPH+ 0] = - np2_pal16[i+NP2PAL_GRPH+ 8] = - scrnmng_makepal16(np2_pal32[i+NP2PAL_GRPH+0]); - np2_pal16[i+NP2PAL_GRPH+ 4] = - np2_pal16[i+NP2PAL_GRPH+12] = - scrnmng_makepal16(np2_pal32[i+NP2PAL_GRPH+4]); - } - if (np2cfg.skipline) { - for (i=0; i<4; i++) { - np2_pal16[i+NP2PAL_SKIP+ 0] = - np2_pal16[i+NP2PAL_SKIP+ 8] = - scrnmng_makepal16(np2_pal32[i+NP2PAL_SKIP+0]); - np2_pal16[i+NP2PAL_SKIP+ 4] = - np2_pal16[i+NP2PAL_SKIP+12] = - scrnmng_makepal16(np2_pal32[i+NP2PAL_SKIP+4]); - } - } - } -#endif -} - -static void pal_makedegital_mono(const UINT8 *paltbl) { - - UINT i; -#if defined(SUPPORT_16BPP) - RGB16 pal16; -#endif - - if ((np2cfg.LCD_MODE & 3) == 3) { - // LCD mode - for (i = 0; i < 8; i++) - { - np2_pal32[i + NP2PAL_GRPH].d = lcdpal[i].d; - } - np2_pal32[8 + NP2PAL_GRPH].d = 0xffffff; - if (np2cfg.skipline) { - for (i = 0; i < 8; i++) - { - np2_pal32[i + NP2PAL_SKIP].d = lcdpal[i].d; - } - } - } -#if defined(SUPPORT_16BPP) - if (scrnmng_getbpp() == 16) { - for (i = 0; i < 8; i++) - { - pal16 = scrnmng_makepal16(lcdpal[i]); - np2_pal16[i + NP2PAL_GRPH] = pal16; - } - np2_pal16[8 + NP2PAL_GRPH] = scrnmng_makepal16(np2_pal32[8 + NP2PAL_GRPH]); - if (np2cfg.skipline) - { - for (i = 0; i < 8; i++) - { - pal16 = scrnmng_makepal16(lcdpal[i]); - np2_pal16[i + NP2PAL_SKIP] = pal16; - } - } - } else -#endif - { - for (i = 0; i < 8; i++) - { - np2_pal32[i + NP2PAL_GRPH].d = degpal1[i].d; - } - np2_pal32[8 + NP2PAL_GRPH].d = 0x0000000; - if (np2cfg.skipline) { - for (i = 0; i < 8; i++) - { - np2_pal32[i + NP2PAL_SKIP].d = degpal1[i].d; - } - } -#if defined(SUPPORT_16BPP) - if (scrnmng_getbpp() == 16) - { - for (i = 0; i < 8; i++) - { - pal16 = scrnmng_makepal16(degpal1[i]); - np2_pal16[i + NP2PAL_GRPH] = pal16; - } - np2_pal16[8 + NP2PAL_GRPH] = scrnmng_makepal16(np2_pal32[8 + NP2PAL_GRPH]); - if (np2cfg.skipline) - { - for (i = 0; i < 8; i++) - { - pal16 = scrnmng_makepal16(degpal1[i]); - np2_pal16[i + NP2PAL_SKIP] = pal16; - } - } - } -#endif - } -} - -void pal_makeanalog_lcd(RGB32 *pal, UINT16 bit) { - - UINT i; - UINT j; - - for (i=0; ip.b & 15); - j |= (pal->p.r & 15) << 4; - j |= (pal->p.g & 15) << 8; - np2_pal32[i+NP2PAL_SKIP].d = - np2_pal32[i+NP2PAL_GRPH].d = lcdpal[lcdtbl[j]].d; - } - } -#if defined(SUPPORT_16BPP) - if (scrnmng_getbpp() == 16) { - for (i=0; i> 3) & 14].d; - np2_pal32[i+NP2PAL_GRPH+ 0].d = pal32; - np2_pal32[i+NP2PAL_GRPH+ 8].d = pal32; - pal32 = lcdpal[(paltbl[i] << 1) & 14].d; - np2_pal32[i+NP2PAL_GRPH+ 4].d = pal32; - np2_pal32[i+NP2PAL_GRPH+12].d = pal32; - if (np2cfg.skipline) { - pal32 = np2_pal32[i+NP2PAL_GRPH+ 0].d; - np2_pal32[i+NP2PAL_SKIP+ 0].d = pal32; - np2_pal32[i+NP2PAL_SKIP+ 8].d = pal32; - pal32 = np2_pal32[i+NP2PAL_GRPH+ 4].d; - np2_pal32[i+NP2PAL_SKIP+ 4].d = pal32; - np2_pal32[i+NP2PAL_SKIP+12].d = pal32; - } - } -#if defined(SUPPORT_16BPP) - if (scrnmng_getbpp() == 16) { - for (i=0; i<4; i++) { - pal16 = scrnmng_makepal16(np2_pal32[i+NP2PAL_GRPH+0]); - np2_pal16[i+NP2PAL_GRPH+ 0] = pal16; - np2_pal16[i+NP2PAL_GRPH+ 8] = pal16; - pal16 = scrnmng_makepal16(np2_pal32[i+NP2PAL_GRPH+4]); - np2_pal16[i+NP2PAL_GRPH+ 4] = pal16; - np2_pal16[i+NP2PAL_GRPH+12] = pal16; - } - if (np2cfg.skipline) { - for (i=0; i<4; i++) { - pal16 = np2_pal16[i+NP2PAL_GRPH+ 0]; - np2_pal16[i+NP2PAL_SKIP+ 0] = pal16; - np2_pal16[i+NP2PAL_SKIP+ 8] = pal16; - pal16 = np2_pal16[i+NP2PAL_GRPH+ 4]; - np2_pal16[i+NP2PAL_SKIP+ 4] = pal16; - np2_pal16[i+NP2PAL_SKIP+12] = pal16; - } - } - } -#endif -} - -static void pal_maketext(void) { - - UINT i; - UINT j; - UINT k; -#if defined(SUPPORT_16BPP) - RGB16 pal16; -#endif - - k = NP2PAL_TEXT2; - for (i=0; i<8; i++) { - np2_pal32[i+1+NP2PAL_TEXT].d = degpal1[i].d; - np2_pal32[i+1+NP2PAL_TEXT3].d = degpal1[i].d; - for (j=0; j +#include +#include +#include +#include +#include + + RGB32 np2_pal32[NP2PAL_MAX]; +#if defined(SUPPORT_16BPP) + RGB16 np2_pal16[NP2PAL_MAX]; +#endif + + PALEVENT palevent; +static RGB32 degpal1[8]; +static RGB32 degpal2[8]; +static UINT8 anapal1[16]; +static UINT8 anapal2[16]; + +static RGB32 lcdpal[15]; +static UINT8 lcdtbl[0x1000]; + UINT8 pal_monotable[16] = {0, 0, 0, 0, 1, 1, 1, 1, + 0, 0, 0, 0, 1, 1, 1, 1}; + +static const UINT8 lcdpal_a[27] = { 0, 1, 2, 3, 5, 2, 4, 4, 6, + 7, 9, 2,11,13, 2, 4, 4, 6, + 8, 8,10, 8, 8,10,12,12,14}; +static const UINT8 deftbl[4] = {0x04, 0x15, 0x26, 0x37}; + + +void pal_makegrad(RGB32 *pal, int pals, UINT32 bg, UINT32 fg) { + + int i; + + if (pals >= 2) { + pals--; + for (i=0; i<=pals; i++) { + pal[i].p.b = (UINT8) + ((((fg >> 0) & 0x0000ff) * i + + ((bg >> 0) & 0x0000ff) * (pals-i)) / pals); + pal[i].p.g = (UINT8) + ((((fg >> 8) & 0x0000ff) * i + + ((bg >> 8) & 0x0000ff) * (pals-i)) / pals); + pal[i].p.r = (UINT8) + ((((fg >> 16) & 0x0000ff) * i + + ((bg >> 16) & 0x0000ff) * (pals-i)) / pals); + pal[i].p.e = 0; + } + } +} + + +// ---- + +void pal_initlcdtable(void) { + + UINT i; + int j; + + for (i=0; i<0x1000; i++) { + j = 0; + if ((i & 0x00f) >= 0x004) { // b + j++; + if ((i & 0x00f) >= 0x00b) { + j++; + } + } + if ((i & 0x0f0) >= 0x040) { // r + j += 3; + if ((i & 0x0f0) >= 0x0b0) { + j += 3; + } + } + if ((i & 0xf00) >= 0x400) { // g + j += 9; + if ((i & 0xf00) >= 0xb00) { + j += 9; + } + } + lcdtbl[i] = lcdpal_a[j]; + } +} + +void pal_makelcdpal(void) { + + if (!(np2cfg.LCD_MODE & 2)) { + pal_makegrad(lcdpal, 15, np2cfg.BG_COLOR, np2cfg.FG_COLOR); + } + else { + pal_makegrad(lcdpal, 15, np2cfg.FG_COLOR, np2cfg.BG_COLOR); + } +} + +void pal_makeskiptable(void) { + + int i; + RGB32 pal; + UINT8 ana; + + for (i=0; i<8; i++) { + pal.p.b = (UINT8)(i & 1); + pal.p.r = (UINT8)((i >> 1) & 1); + pal.p.g = (UINT8)((i >> 2) & 1); + pal.p.e = 0; + degpal1[i].d = pal.d * 255; + degpal2[i].d = pal.d * np2cfg.skiplight; + } + for (i=0; i<16; i++) { + ana = (UINT8)(i * 0x11); + anapal1[i] = ana; + anapal2[i] = (UINT8)((np2cfg.skiplight * anapal1[i]) / 255); + } +} + + +// --------------------------------------------------------------------------- + +void pal_makeanalog(RGB32 *pal, UINT16 bit) { + + UINT i; + + for (i=0; ip.b & 15]; + np2_pal32[i+NP2PAL_GRPH].p.g = anapal1[pal->p.g & 15]; + np2_pal32[i+NP2PAL_GRPH].p.r = anapal1[pal->p.r & 15]; + if (np2cfg.skipline) { + np2_pal32[i+NP2PAL_SKIP].p.b = anapal2[pal->p.b & 15]; + np2_pal32[i+NP2PAL_SKIP].p.g = anapal2[pal->p.g & 15]; + np2_pal32[i+NP2PAL_SKIP].p.r = anapal2[pal->p.r & 15]; + } + } + } +#if defined(SUPPORT_16BPP) + if (scrnmng_getbpp() == 16) { + for (i=0; i> 4) & 7].d; + np2_pal32[i+NP2PAL_GRPH+ 4].d = + np2_pal32[i+NP2PAL_GRPH+12].d = + degpal1[paltbl[i] & 7].d; + if (np2cfg.skipline) { + np2_pal32[i+NP2PAL_SKIP+ 0].d = + np2_pal32[i+NP2PAL_SKIP+ 8].d = + degpal2[(paltbl[i] >> 4) & 7].d; + np2_pal32[i+NP2PAL_SKIP+ 4].d = + np2_pal32[i+NP2PAL_SKIP+12].d = + degpal2[paltbl[i] & 7].d; + } + } +#if defined(SUPPORT_16BPP) + if (scrnmng_getbpp() == 16) { + for (i=0; i<4; i++) { + np2_pal16[i+NP2PAL_GRPH+ 0] = + np2_pal16[i+NP2PAL_GRPH+ 8] = + scrnmng_makepal16(np2_pal32[i+NP2PAL_GRPH+0]); + np2_pal16[i+NP2PAL_GRPH+ 4] = + np2_pal16[i+NP2PAL_GRPH+12] = + scrnmng_makepal16(np2_pal32[i+NP2PAL_GRPH+4]); + } + if (np2cfg.skipline) { + for (i=0; i<4; i++) { + np2_pal16[i+NP2PAL_SKIP+ 0] = + np2_pal16[i+NP2PAL_SKIP+ 8] = + scrnmng_makepal16(np2_pal32[i+NP2PAL_SKIP+0]); + np2_pal16[i+NP2PAL_SKIP+ 4] = + np2_pal16[i+NP2PAL_SKIP+12] = + scrnmng_makepal16(np2_pal32[i+NP2PAL_SKIP+4]); + } + } + } +#endif +} + +static void pal_makedegital_mono(const UINT8 *paltbl) { + + UINT i; +#if defined(SUPPORT_16BPP) + RGB16 pal16; +#endif + + if ((np2cfg.LCD_MODE & 3) == 3) { + // LCD mode + for (i = 0; i < 8; i++) + { + np2_pal32[i + NP2PAL_GRPH].d = lcdpal[i].d; + } + np2_pal32[8 + NP2PAL_GRPH].d = 0xffffff; + if (np2cfg.skipline) { + for (i = 0; i < 8; i++) + { + np2_pal32[i + NP2PAL_SKIP].d = lcdpal[i].d; + } + } + } +#if defined(SUPPORT_16BPP) + if (scrnmng_getbpp() == 16) { + for (i = 0; i < 8; i++) + { + pal16 = scrnmng_makepal16(lcdpal[i]); + np2_pal16[i + NP2PAL_GRPH] = pal16; + } + np2_pal16[8 + NP2PAL_GRPH] = scrnmng_makepal16(np2_pal32[8 + NP2PAL_GRPH]); + if (np2cfg.skipline) + { + for (i = 0; i < 8; i++) + { + pal16 = scrnmng_makepal16(lcdpal[i]); + np2_pal16[i + NP2PAL_SKIP] = pal16; + } + } + } else +#endif + { + for (i = 0; i < 8; i++) + { + np2_pal32[i + NP2PAL_GRPH].d = degpal1[i].d; + } + np2_pal32[8 + NP2PAL_GRPH].d = 0x0000000; + if (np2cfg.skipline) { + for (i = 0; i < 8; i++) + { + np2_pal32[i + NP2PAL_SKIP].d = degpal1[i].d; + } + } +#if defined(SUPPORT_16BPP) + if (scrnmng_getbpp() == 16) + { + for (i = 0; i < 8; i++) + { + pal16 = scrnmng_makepal16(degpal1[i]); + np2_pal16[i + NP2PAL_GRPH] = pal16; + } + np2_pal16[8 + NP2PAL_GRPH] = scrnmng_makepal16(np2_pal32[8 + NP2PAL_GRPH]); + if (np2cfg.skipline) + { + for (i = 0; i < 8; i++) + { + pal16 = scrnmng_makepal16(degpal1[i]); + np2_pal16[i + NP2PAL_SKIP] = pal16; + } + } + } +#endif + } +} + +void pal_makeanalog_lcd(RGB32 *pal, UINT16 bit) { + + UINT i; + UINT j; + + for (i=0; ip.b & 15); + j |= (pal->p.r & 15) << 4; + j |= (pal->p.g & 15) << 8; + np2_pal32[i+NP2PAL_SKIP].d = + np2_pal32[i+NP2PAL_GRPH].d = lcdpal[lcdtbl[j]].d; + } + } +#if defined(SUPPORT_16BPP) + if (scrnmng_getbpp() == 16) { + for (i=0; i> 3) & 14].d; + np2_pal32[i+NP2PAL_GRPH+ 0].d = pal32; + np2_pal32[i+NP2PAL_GRPH+ 8].d = pal32; + pal32 = lcdpal[(paltbl[i] << 1) & 14].d; + np2_pal32[i+NP2PAL_GRPH+ 4].d = pal32; + np2_pal32[i+NP2PAL_GRPH+12].d = pal32; + if (np2cfg.skipline) { + pal32 = np2_pal32[i+NP2PAL_GRPH+ 0].d; + np2_pal32[i+NP2PAL_SKIP+ 0].d = pal32; + np2_pal32[i+NP2PAL_SKIP+ 8].d = pal32; + pal32 = np2_pal32[i+NP2PAL_GRPH+ 4].d; + np2_pal32[i+NP2PAL_SKIP+ 4].d = pal32; + np2_pal32[i+NP2PAL_SKIP+12].d = pal32; + } + } +#if defined(SUPPORT_16BPP) + if (scrnmng_getbpp() == 16) { + for (i=0; i<4; i++) { + pal16 = scrnmng_makepal16(np2_pal32[i+NP2PAL_GRPH+0]); + np2_pal16[i+NP2PAL_GRPH+ 0] = pal16; + np2_pal16[i+NP2PAL_GRPH+ 8] = pal16; + pal16 = scrnmng_makepal16(np2_pal32[i+NP2PAL_GRPH+4]); + np2_pal16[i+NP2PAL_GRPH+ 4] = pal16; + np2_pal16[i+NP2PAL_GRPH+12] = pal16; + } + if (np2cfg.skipline) { + for (i=0; i<4; i++) { + pal16 = np2_pal16[i+NP2PAL_GRPH+ 0]; + np2_pal16[i+NP2PAL_SKIP+ 0] = pal16; + np2_pal16[i+NP2PAL_SKIP+ 8] = pal16; + pal16 = np2_pal16[i+NP2PAL_GRPH+ 4]; + np2_pal16[i+NP2PAL_SKIP+ 4] = pal16; + np2_pal16[i+NP2PAL_SKIP+12] = pal16; + } + } + } +#endif +} + +static void pal_maketext(void) { + + UINT i; + UINT j; + UINT k; +#if defined(SUPPORT_16BPP) + RGB16 pal16; +#endif + + k = NP2PAL_TEXT2; + for (i=0; i<8; i++) { + np2_pal32[i+1+NP2PAL_TEXT].d = degpal1[i].d; + np2_pal32[i+1+NP2PAL_TEXT3].d = degpal1[i].d; + for (j=0; j +#include +#include +#include +#include #include "sdraw.h" -#include "dispsync.h" -#include "palettes.h" +#include +#include +#if defined(SUPPORT_VIDEOFILTER) +#include +#endif #ifdef SUPPORT_WAB -#include "wab/wab.h" +#include #endif @@ -15,7 +18,9 @@ UINT8 np2_tram[SURFACE_SIZE]; UINT8 np2_vram[2][SURFACE_SIZE]; UINT8 redrawpending = 0; - +#if defined(SUPPORT_VIDEOFILTER) + BOOL bPreEnable; +#endif static void updateallline(UINT32 update) { @@ -75,7 +80,7 @@ static UINT8 rasterdraw(SDRAWFN sdrawfn, SDRAW sdraw, int maxy) { if (event >= eventterm) { break; } - // ‚¨•Ω“–‚Ν‚ ‚Α‚½H + // γŠεΌε½“γ―γ‚γ£γŸοΌŸ if (clk < event->clock) { if (!(np2cfg.LCD_MODE & 1)) { pal_makeanalog(pal, 0xffff); @@ -91,7 +96,7 @@ static UINT8 rasterdraw(SDRAWFN sdrawfn, SDRAW sdraw, int maxy) { } (*sdrawfn)(sdraw, y); nextupdate = y; - // ‚¨•Ω“–‚πH‚Χ‚ι + // γŠεΌε½“γ‚’ι£ŸγΉγ‚‹ while(clk < event->clock) { ((UINT8 *)pal)[event->color] = event->value; event++; @@ -131,6 +136,10 @@ static UINT8 rasterdraw(SDRAWFN sdrawfn, SDRAW sdraw, int maxy) { } } +#ifdef SUPPORT_WAB +void scrnmng_update(void); +#endif + UINT8 scrndraw_draw(UINT8 redraw) { UINT8 ret; @@ -141,7 +150,6 @@ const SDRAWFN *sdrawfn; int i; int height; - if (redraw || redrawpending) { updateallline(0x80808080); redrawpending = 0; @@ -155,7 +163,7 @@ const SDRAWFN *sdrawfn; if(np2wab.relay & 0x3){ np2wab_drawframe(); if(!np2wabwnd.multiwindow){ - // XXX: ƒEƒBƒ“ƒhƒEƒAƒNƒZƒ‰ƒŒ[ƒ^“μ’†‚Ν“ΰ‘ ƒOƒ‰ƒtƒBƒbƒN‚π•`‰ζ‚΅‚Θ‚’ + // XXX: γ‚¦γ‚£γƒ³γƒ‰γ‚¦γ‚’γ‚―γ‚»γƒ©γƒ¬γƒΌγ‚Ώε‹•δ½œδΈ­γ―ε†…θ”΅γ‚°γƒ©γƒ•γ‚£γƒƒγ‚―γ‚’ζη”»γ—γͺい ret = 1; return(ret); } @@ -250,6 +258,21 @@ const SDRAWFN *sdrawfn; sdraw.src2 = np2_tram; break; } +#if defined(SUPPORT_VIDEOFILTER) + bVFEnable = VideoFilter_GetEnable(hVFMng1) & !np2cfg.vf1_bmponly; + bVFImport = FALSE; + if(bVFEnable) { + if(bit & 3) { + VideoFilter_Import98(hVFMng1, (bit & 1) ? np2_vram[0] : np2_vram[1], sdraw.dirty, (gdc.analog & 2) ? TRUE : FALSE); + bVFImport = TRUE; + VideoFilter_Calc(hVFMng1); + } + } + if(bPreEnable != bVFEnable) { + memset(sdraw.dirty, 1, SURFACE_HEIGHT); + bPreEnable = bVFEnable; + } +#endif sdraw.dst = surf->ptr; sdraw.width = surf->width; sdraw.xbytes = surf->xalign * surf->width; diff --git a/vram/scrndraw.h b/vram/scrndraw.h old mode 100644 new mode 100755 index 5a64ecf6..10a25b08 --- a/vram/scrndraw.h +++ b/vram/scrndraw.h @@ -1,33 +1,37 @@ - -#ifndef SCRNCALL -#define SCRNCALL -#endif - -enum { - SURFACE_WIDTH = 640, - SURFACE_HEIGHT = 480, - SURFACE_SIZE = (SURFACE_WIDTH * SURFACE_HEIGHT), - - START_PALORG = 0x0a, - START_PAL = 0x10 -}; - - -#ifdef __cplusplus -extern "C" { -#endif - -extern UINT8 renewal_line[SURFACE_HEIGHT]; -extern UINT8 np2_tram[SURFACE_SIZE]; -extern UINT8 np2_vram[2][SURFACE_SIZE]; - -void scrndraw_initialize(void); -void scrndraw_changepalette(void); -UINT8 scrndraw_draw(UINT8 update); -void scrndraw_redraw(void); -void scrndraw_updateallline(void); - -#ifdef __cplusplus -} -#endif - +#ifndef NP2_SCRNDRAW_H +#define NP2_SCRNDRAW_H + +#ifndef SCRNCALL +#define SCRNCALL +#endif + +enum { + SURFACE_WIDTH = 640, + SURFACE_HEIGHT = 480, + SURFACE_SIZE = (SURFACE_WIDTH * SURFACE_HEIGHT), + + START_PALORG = 0x0a, + START_PAL = 0x10 +}; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern UINT8 renewal_line[SURFACE_HEIGHT]; +extern UINT8 np2_tram[SURFACE_SIZE]; +extern UINT8 np2_vram[2][SURFACE_SIZE]; + +void scrndraw_initialize(void); +void scrndraw_changepalette(void); +UINT8 scrndraw_draw(UINT8 update); +void scrndraw_redraw(void); +void scrndraw_updateallline(void); + +#ifdef __cplusplus +} +#endif + +#endif /* NP2_SCRNDRAW_H */ + diff --git a/vram/scrnsave.c b/vram/scrnsave.c old mode 100644 new mode 100755 index b72e8433..479cc9ca --- a/vram/scrnsave.c +++ b/vram/scrnsave.c @@ -1,797 +1,860 @@ -/** - * @file scrnsave.c - * @brief Implementation of the screen saver - */ - -#include "compiler.h" -#include "bmpdata.h" -#include "scrnsave.h" -#include "dosio.h" -#include "pccore.h" -#include "iocore.h" -#include "scrndraw.h" -#include "dispsync.h" -#include "palettes.h" - -/** - * @brief The structure of screen saver - */ -struct tagScrnSave -{ - int width; - int height; - UINT pals; - UINT type; -}; - -#if defined(SUPPORT_PC9821) -typedef unsigned short PALNUM; -#else -typedef unsigned char PALNUM; -#endif - -typedef union { - UINT32 d; - UINT8 rgb[4]; -} BMPPAL; - -typedef struct { - int width; - int height; - UINT pals; - UINT type; - BMPPAL pal[NP2PAL_MAX]; - PALNUM dat[SURFACE_WIDTH * SURFACE_HEIGHT]; -} SCRNDATA; - - -static void screenmix(PALNUM *dest, const UINT8 *src1, const UINT8 *src2) { - - int i; - - for (i=0; i<(SURFACE_WIDTH * SURFACE_HEIGHT); i++) { - dest[i] = src1[i] + src2[i] + NP2PAL_GRPH; - } -} - -static void screenmix2(PALNUM *dest, const UINT8 *src1, const UINT8 *src2) { - - int x, y; - - for (y=0; y<(SURFACE_HEIGHT/2); y++) { - for (x=0; x> 4) + NP2PAL_TEXT; - } - dest += SURFACE_WIDTH; - src1 += SURFACE_WIDTH; - src2 += SURFACE_WIDTH; - } -} - -static void screenmix3(PALNUM *dest, const UINT8 *src1, const UINT8 *src2) { - - PALNUM c; - int x, y; - - for (y=0; y<(SURFACE_HEIGHT/2); y++) { - // dest == src1, dest == src2 ‚ΜŽž‚ͺ‚ ‚ι‚̂Łc - for (x=0; x> 4; - if (!c) { - c = src2[x] + NP2PAL_SKIP; - } - dest[x + SURFACE_WIDTH] = c; - dest[x] = src1[x] + src2[x] + NP2PAL_GRPH; - } - dest += SURFACE_WIDTH * 2; - src1 += SURFACE_WIDTH * 2; - src2 += SURFACE_WIDTH * 2; - } -} - -#if defined(SUPPORT_PC9821) -static void screenmix4(PALNUM *dest, const UINT8 *src1, const UINT8 *src2) { - - int i; - - for (i=0; i<(SURFACE_WIDTH * SURFACE_HEIGHT); i++) { - if (src1[i]) { - dest[i] = (src1[i] >> 4) + NP2PAL_TEXTEX; - } - else { - dest[i] = src2[i] + NP2PAL_GRPHEX; - } - } -} -#endif - - -// ---- - -/** - * Create - * @return The handle of saver - */ -SCRNSAVE scrnsave_create(void) -{ - int width; - int height; - SCRNDATA *sd; - PALNUM *dat; - UINT scrnsize; - UINT8 *datanull; - UINT8 *datatext; - UINT8 *datagrph; - void (*mix)(PALNUM *dest, const UINT8 *src1, const UINT8 *src2); - PALNUM *s; - UINT pals; - PALNUM remap[NP2PAL_MAX]; - UINT8 remapflag[NP2PAL_MAX]; - int x; - int y; - PALNUM col; - BMPPAL curpal; - UINT pos; - - width = dsync.scrnxmax; - height = dsync.scrnymax; - if ((width <= 0) || (height <= 0)) { - goto ssg_err; - } - sd = (SCRNDATA *)_MALLOC(sizeof(SCRNDATA), "screen data"); - if (sd == NULL) { - goto ssg_err; - } - ZeroMemory(sd, sizeof(SCRNDATA)); - - dat = sd->dat; - scrnsize = SURFACE_WIDTH * SURFACE_HEIGHT; - datanull = ((UINT8 *)dat) + (scrnsize * (sizeof(PALNUM) - 1)); - datatext = datanull; - datagrph = datanull; - if (gdcs.textdisp & 0x80) { - datatext = np2_tram; - } - if (gdcs.grphdisp & 0x80) { -#if defined(SUPPORT_PC9821) - if ((gdc.analog & 6) == 6) { - datagrph = np2_vram[0]; - } - else -#endif - datagrph = np2_vram[gdcs.disp]; - } -#if defined(SUPPORT_PC9821) - if (gdc.analog & 2) { - mix = screenmix4; - } - else -#endif - if (!(gdc.mode1 & 0x10)) { - mix = screenmix; - } - else if (!np2cfg.skipline) { - mix = screenmix2; - } - else { - mix = screenmix3; - } - (*mix)(sd->dat, datatext, datagrph); - - // ƒpƒŒƒbƒgΕ“K‰» - s = sd->dat; - pals = 0; - ZeroMemory(remap, sizeof(remap)); - ZeroMemory(remapflag, sizeof(remapflag)); - for (y=0; ypal[pos].d == curpal.d) { - break; - } - } - if (pos >= pals) { - sd->pal[pos].d = curpal.d; - pals++; - } - remap[col] = (PALNUM)pos; - } - s[x] = remap[col]; - } - s += SURFACE_WIDTH; - } - sd->width = width; - sd->height = height; - sd->pals = pals; - if (pals <= 2) { - sd->type = SCRNSAVE_1BIT; - } - else if (pals <= 16) { - sd->type = SCRNSAVE_4BIT; - } - else if (pals <= 256) { - sd->type = SCRNSAVE_8BIT; - } - else { - sd->type = SCRNSAVE_24BIT; - } - return((SCRNSAVE)sd); - -ssg_err: - return(NULL); -} - -/** - * Destroy - * @param[in] hdl The handle of saver - */ -void scrnsave_destroy(SCRNSAVE hdl) -{ - if (hdl) - { - _MFREE(hdl); - } -} - -/** - * Get BPP - * @param[in] hdl The handle of saver - * @return bpp - */ -int scrnsave_gettype(SCRNSAVE hdl) -{ - int ret = 0; - - if (hdl) - { - ret = hdl->type; - } - return ret; -} - -// ---- BMP - -BRESULT scrnsave_writebmp(SCRNSAVE hdl, const OEMCHAR *filename, UINT flag) { - -const SCRNDATA *sd; - FILEH fh; - BMPDATA bd; - UINT type; - UINT palsize; - BMPFILE bf; - UINT pos; - BMPINFO bi; - UINT8 palwork[1024]; - UINT align; - UINT8 *work; -const PALNUM *s; - int r; - int x; - BMPPAL curpal; - - (void)flag; - - if (hdl == NULL) { - goto sswb_err1; - } - sd = (SCRNDATA *)hdl; - - fh = file_create(filename); - if (fh == FILEH_INVALID) { - goto sswb_err1; - } - - bd.width = sd->width; - bd.height = sd->height; - if (sd->pals <= 2) { - type = SCRNSAVE_1BIT; - bd.bpp = 1; - palsize = 4 << 1; - } - else if (sd->pals <= 16) { - type = SCRNSAVE_4BIT; - bd.bpp = 4; - palsize = 4 << 4; - } - else if (sd->pals <= 256) { - type = SCRNSAVE_8BIT; - bd.bpp = 8; - palsize = 4 << 8; - } - else { - type = SCRNSAVE_24BIT; - bd.bpp = 24; - palsize = 0; - } - - // Bitmap File - ZeroMemory(&bf, sizeof(bf)); - bf.bfType[0] = 'B'; - bf.bfType[1] = 'M'; - pos = sizeof(BMPFILE) + sizeof(BMPINFO) + palsize; - STOREINTELDWORD(bf.bfOffBits, pos); - - // Bitmap Info - bmpdata_setinfo(&bi, &bd); - STOREINTELDWORD(bi.biClrImportant, sd->pals); - align = bmpdata_getalign(&bi); - - // Bitmap File (size) - STOREINTELDWORD(bf.bfSize, (sizeof(BMPFILE) + sizeof(BMPINFO) + palsize + bmpdata_getalign(&bi) * bd.height)); - - if (file_write(fh, &bf, sizeof(bf)) != sizeof(bf)) { - goto sswb_err2; - } - if (file_write(fh, &bi, sizeof(bi)) != sizeof(bi)) { - goto sswb_err2; - } - - if (palsize) { - ZeroMemory(palwork, palsize); - CopyMemory(palwork, sd->pal, sd->pals * 4); - if (file_write(fh, palwork, palsize) != palsize) { - goto sswb_err2; - } - } - - work = (UINT8 *)_MALLOC(align, filename); - if (work == NULL) { - goto sswb_err2; - } - ZeroMemory(work, align); - - s = sd->dat + (SURFACE_WIDTH * bd.height); - do { - s -= SURFACE_WIDTH; - switch(type) { - case SCRNSAVE_1BIT: - ZeroMemory(work, align); - for (x=0; x> 3] |= 0x80 >> (x & 7); - } - } - break; - - case SCRNSAVE_4BIT: - r = bd.width / 2; - for (x=0; xpal[s[x]].d; - work[x*3+0] = curpal.rgb[0]; - work[x*3+1] = curpal.rgb[1]; - work[x*3+2] = curpal.rgb[2]; - } - break; - } - if (file_write(fh, work, align) != align) { - goto sswb_err3; - } - } while(--bd.height); - - file_close(fh); - _MFREE(work); - return(SUCCESS); - -sswb_err3: - _MFREE(work); - -sswb_err2: - file_close(fh); - file_delete(filename); - -sswb_err1: - return(FAILURE); -} - -BRESULT scrnsave_getbmp(SCRNSAVE hdl, BMPFILE *lpbf, BMPINFO *lpbi, UINT8 **lplppal, UINT8 **lplppixels, UINT flag) { - -const SCRNDATA *sd; - BMPDATA bd; - UINT type; - UINT palsize; - BMPFILE bf; - UINT pos; - BMPINFO bi; - UINT8 palwork[1024]; - UINT align; - UINT8 *work; -const PALNUM *s; - int r; - int x; - BMPPAL curpal; - UINT8 *dstpix; - - (void)flag; - - if (hdl == NULL) { - goto sswb_err1; - } - sd = (SCRNDATA *)hdl; - - bd.width = sd->width; - bd.height = sd->height; - if (sd->pals <= 2) { - type = SCRNSAVE_1BIT; - bd.bpp = 1; - palsize = 4 << 1; - } - else if (sd->pals <= 16) { - type = SCRNSAVE_4BIT; - bd.bpp = 4; - palsize = 4 << 4; - } - else if (sd->pals <= 256) { - type = SCRNSAVE_8BIT; - bd.bpp = 8; - palsize = 4 << 8; - } - else { - type = SCRNSAVE_24BIT; - bd.bpp = 24; - palsize = 0; - } - - // Bitmap File - ZeroMemory(&bf, sizeof(bf)); - bf.bfType[0] = 'B'; - bf.bfType[1] = 'M'; - pos = sizeof(BMPFILE) + sizeof(BMPINFO) + palsize; - STOREINTELDWORD(bf.bfOffBits, pos); - - // Bitmap Info - bmpdata_setinfo(&bi, &bd); - STOREINTELDWORD(bi.biClrImportant, sd->pals); - align = bmpdata_getalign(&bi); - CopyMemory(lpbi, &bi, sizeof(bi)); - *lplppal = (UINT8*)malloc(palsize); - if (palsize) { - ZeroMemory(palwork, palsize); - CopyMemory(palwork, sd->pal, sd->pals * 4); - CopyMemory(*lplppal, palwork, palsize); - } - - // Bitmap File (size) - STOREINTELDWORD(bf.bfSize, (sizeof(BMPFILE) + sizeof(BMPINFO) + palsize + bmpdata_getalign(&bi) * bd.height)); - CopyMemory(lpbf, &bf, sizeof(bf)); - - work = (UINT8 *)_MALLOC(align, filename); - if (work == NULL) { - goto sswb_err2; - } - ZeroMemory(work, align); - - *lplppixels = (UINT8*)malloc(bmpdata_getalign(&bi) * bd.height); - dstpix = *lplppixels; - s = sd->dat + (SURFACE_WIDTH * bd.height); - do { - s -= SURFACE_WIDTH; - switch(type) { - case SCRNSAVE_1BIT: - ZeroMemory(work, align); - for (x=0; x> 3] |= 0x80 >> (x & 7); - } - } - break; - - case SCRNSAVE_4BIT: - r = bd.width / 2; - for (x=0; xpal[s[x]].d; - work[x*3+0] = curpal.rgb[0]; - work[x*3+1] = curpal.rgb[1]; - work[x*3+2] = curpal.rgb[2]; - } - break; - } - - CopyMemory(dstpix, work, align); - dstpix += align; - } while(--bd.height); - - - _MFREE(work); - return(SUCCESS); - -//sswb_err3: -// _MFREE(work); -sswb_err2: -sswb_err1: - return(FAILURE); -} - - -// ---- GIF - -#if 1 -#define MAXGIFBITS 12 - -#if MAXGIFBITS == 12 -#define HASHTBLSIZE 5003 -#elif MAXGIFBITS == 13 -#define HASHTBLSIZE 9001 -#elif MAXGIFBITS == 14 -#define HASHTBLSIZE 18013 -#elif MAXGIFBITS == 15 -#define HASHTBLSIZE 35023 -#elif MAXGIFBITS == 16 -#define HASHTBLSIZE 69001 -#endif - -#define GIFBITDATAWRITE(dat) \ - do { \ - bitdata |= (dat) << bits; \ - bits += bitcount; \ - while(bits >= 8) { \ - bitbuf[++bitdatas] = (UINT8)bitdata; \ - if (bitdatas >= 255) { \ - bitbuf[0] = (UINT8)bitdatas; \ - r = 1 + bitdatas; \ - if (file_write(fh, bitbuf, r) != r) { \ - goto sswg_err4; \ - } \ - bitdatas = 0; \ - } \ - bitdata >>= 8; \ - bits -= 8; \ - } \ - } while(/*CONSTCOND*/ 0) - -#define GIFBITEXTENSION \ - do { \ - if (codefree > codemax) { \ - bitcount++; \ - if (bitcount < MAXGIFBITS) { \ - codemax = (codemax << 1) + 1; \ - } \ - else { \ - codemax = 1 << MAXGIFBITS; \ - } \ - } \ - } while(/*CONSTCOND*/ 0) - -#define GIFBITDATAFLASH \ - do { \ - if (bits) { \ - bitbuf[++bitdatas] = (UINT8)bitdata; \ - } \ - if (bitdatas) { \ - bitbuf[0] = (UINT8)bitdatas; \ - r = 1 + bitdatas; \ - if (file_write(fh, bitbuf, r) != r) { \ - goto sswg_err4; \ - } \ - } \ - } while(/*CONSTCOND*/ 0) - - -BRESULT scrnsave_writegif(SCRNSAVE hdl, const OEMCHAR *filename, UINT flag) { - -const SCRNDATA *sd; - UINT bpp; - UINT *hash_code; - UINT32 *hash_data; - FILEH fh; - UINT r; -const PALNUM *s; - - UINT codeclear; - UINT codeeoi; - UINT codefree; - UINT codemax; - - UINT8 bits; - UINT8 bitcount; - UINT bitdata; - UINT bitdatas; - UINT8 bitbuf[3+256*3]; - - int x; - int y; - UINT b; - UINT32 c; - int i; - int disp; - - (void)flag; - - if (hdl == NULL) { - goto sswg_err1; - } - sd = (SCRNDATA *)hdl; - - bpp = 1; - while(sd->pals > (UINT)(1 << bpp)) { - bpp++; - } - if (bpp > 8) { - goto sswg_err1; - } - - hash_code = (UINT *)_MALLOC(HASHTBLSIZE * sizeof(UINT), "hash_code"); - if (hash_code == NULL) { - goto sswg_err1; - } - hash_data = (UINT32 *)_MALLOC(HASHTBLSIZE * sizeof(UINT32), "hash_data"); - if (hash_data == NULL) { - goto sswg_err2; - } - - fh = file_create(filename); - if (fh == FILEH_INVALID) { - goto sswg_err3; - } - - CopyMemory(bitbuf, "GIF87a", 6); - STOREINTELWORD(bitbuf + 6, sd->width); - STOREINTELWORD(bitbuf + 8, sd->height); - if (file_write(fh, bitbuf, 10) != 10) { - goto sswg_err4; - } - - ZeroMemory(bitbuf, sizeof(bitbuf)); - bitbuf[0] = (UINT8)(0x80 + ((8 - 1) << 4) + (bpp - 1)); -// bitbuf[1] = 0; // background -// bitbuf[2] = 0; // reserved - for (r=0; rpals; r++) { - bitbuf[r*3+3] = sd->pal[r].rgb[2]; // R - bitbuf[r*3+4] = sd->pal[r].rgb[1]; // G - bitbuf[r*3+5] = sd->pal[r].rgb[0]; // B - } - r = (1 << bpp) * 3 + 3; - if (file_write(fh, bitbuf, r) != r) { - goto sswg_err4; - } - - bitbuf[0] = 0x2c; // separator - STOREINTELWORD(bitbuf + 1, 0); // sx - STOREINTELWORD(bitbuf + 3, 0); // sy - STOREINTELWORD(bitbuf + 5, sd->width); // cx - STOREINTELWORD(bitbuf + 7, sd->height); // cy - bitbuf[9] = 0; // noninterlace - - bpp = max(bpp, 2); - bitbuf[10] = (UINT8)bpp; - if (file_write(fh, bitbuf, 11) != 11) { - goto sswg_err4; - } - - codeclear = 1 << bpp; - codeeoi = codeclear + 1; - codefree = codeclear + 2; - codemax = (codeclear << 1) - 1; - - bits = 0; - bitdata = 0; - bitdatas = 0; - bitcount = (UINT8)(bpp + 1); - GIFBITDATAWRITE(codeclear); - - ZeroMemory(hash_code, HASHTBLSIZE * sizeof(UINT)); - - x = 0; - y = 0; - s = sd->dat; - b = s[x++]; - do { - while(x < sd->width) { - c = s[x++]; - i = (c << (MAXGIFBITS - 8)) + b; - c = (c << 16) + b; - if (i >= HASHTBLSIZE) { - i -= HASHTBLSIZE; - } - disp = (i != 0)?(i - HASHTBLSIZE):-1; - while(1) { - if (hash_code[i] == 0) { - GIFBITDATAWRITE(b); - GIFBITEXTENSION; - if (codefree < (1 << MAXGIFBITS)) { - hash_code[i] = codefree++; - hash_data[i] = c; - } - else { - ZeroMemory(hash_code, HASHTBLSIZE * sizeof(UINT)); - GIFBITDATAWRITE(codeclear); - codefree = codeclear + 2; - codemax = (codeclear << 1) - 1; - bitcount = (UINT8)(bpp + 1); - } - b = c >> 16; - break; - } - else if (hash_data[i] == c) { - b = hash_code[i]; - break; - } - else { - i += disp; - if (i < 0) { - i += HASHTBLSIZE; - } - } - } - } - x = 0; - s += SURFACE_WIDTH; - y++; - } while(y < sd->height); - - GIFBITDATAWRITE(b); - GIFBITEXTENSION; - GIFBITDATAWRITE(codeeoi); - GIFBITDATAFLASH; - - bitbuf[0] = 0; - if (file_write(fh, bitbuf, 1) != 1) { - goto sswg_err4; - } - - bitbuf[0] = 0x3b; // terminator - if (file_write(fh, bitbuf, 1) != 1) { - goto sswg_err4; - } - - file_close(fh); - _MFREE(hash_data); - _MFREE(hash_code); - return(SUCCESS); - -sswg_err4: - file_close(fh); - file_delete(filename); - -sswg_err3: - _MFREE(hash_data); - -sswg_err2: - _MFREE(hash_code); - -sswg_err1: - return(FAILURE); -} -#endif - +/** + * @file scrnsave.c + * @brief Implementation of the screen saver + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(SUPPORT_VIDEOFILTER) +#include +#endif + +/** + * @brief The structure of screen saver + */ +struct tagScrnSave +{ + int width; + int height; + UINT pals; + UINT type; +}; + +#if defined(SUPPORT_PC9821) +#if defined(SUPPORT_VIDEOFILTER) +typedef uint32_t PALNUM; +#else +typedef unsigned short PALNUM; +#endif +#else +typedef unsigned char PALNUM; +#endif + +typedef union { + UINT32 d; + UINT8 rgb[4]; +} BMPPAL; + +typedef struct { + int width; + int height; + UINT pals; + UINT type; + BMPPAL pal[NP2PAL_MAX]; + PALNUM dat[SURFACE_WIDTH * SURFACE_HEIGHT]; +} SCRNDATA; + + +static void screenmix(PALNUM *dest, const UINT8 *src1, const UINT8 *src2) { + + int i; + + for (i=0; i<(SURFACE_WIDTH * SURFACE_HEIGHT); i++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || src1[i]) { + dest[i] = src1[i]; + } else { + VideoFilter_PutDest(hVFMng1, &dest[i], i % SURFACE_WIDTH, i / SURFACE_WIDTH, 4); + } +#else + dest[i] = src1[i] + src2[i] + NP2PAL_GRPH; +#endif + } +} + +static void screenmix2(PALNUM *dest, const UINT8 *src1, const UINT8 *src2) { + + int x, y; + + for (y=0; y<(SURFACE_HEIGHT/2); y++) { + for (x=0; x> 4) + NP2PAL_TEXT; + } + dest += SURFACE_WIDTH; + src1 += SURFACE_WIDTH; + src2 += SURFACE_WIDTH; + } +} + +static void screenmix3(PALNUM *dest, const UINT8 *src1, const UINT8 *src2) { + + PALNUM c; + int x, y; + + for (y=0; y<(SURFACE_HEIGHT/2); y++) { + // dest == src1, dest == src2 γζ™‚γŒγ‚γ‚‹γγ§β€¦ + for (x=0; x> 4; + if (!c) { + c = src2[x] + NP2PAL_SKIP; + } + dest[x + SURFACE_WIDTH] = c; +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || src1[x]) { + dest[x] = src1[x] + NP2PAL_GRPH; + } else { + VideoFilter_PutDest(hVFMng1, &dest[x], x, y * 2, 4); + } +#else + dest[x] = src1[x] + src2[x] + NP2PAL_GRPH; +#endif + } + dest += SURFACE_WIDTH * 2; + src1 += SURFACE_WIDTH * 2; + src2 += SURFACE_WIDTH * 2; + } +} + +#if defined(SUPPORT_PC9821) +static void screenmix4(PALNUM *dest, const UINT8 *src1, const UINT8 *src2) { + + int i; + + for (i=0; i<(SURFACE_WIDTH * SURFACE_HEIGHT); i++) { + if (src1[i]) { + dest[i] = (src1[i] >> 4) + NP2PAL_TEXTEX; + } + else { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + dest[i] = src2[i] + NP2PAL_GRPHEX; + } else { + VideoFilter_PutDest(hVFMng1, &dest[i], i % SURFACE_WIDTH, i / SURFACE_WIDTH, 4); + } +#else + dest[i] = src2[i] + NP2PAL_GRPHEX; +#endif + } + } +} +#endif + + +// ---- + +/** + * Create + * @return The handle of saver + */ +SCRNSAVE scrnsave_create(void) +{ + int width; + int height; + SCRNDATA *sd; + PALNUM *dat; + UINT scrnsize; + UINT8 *datanull; + UINT8 *datatext; + UINT8 *datagrph; + void (*mix)(PALNUM *dest, const UINT8 *src1, const UINT8 *src2); + PALNUM *s; + UINT pals; + PALNUM remap[NP2PAL_MAX]; + UINT8 remapflag[NP2PAL_MAX]; + int x; + int y; + PALNUM col; + BMPPAL curpal; + UINT pos; + uint8_t* dirty[SURFACE_HEIGHT]; + + + width = dsync.scrnxmax; + height = dsync.scrnymax; + if ((width <= 0) || (height <= 0)) { + goto ssg_err; + } + sd = (SCRNDATA *)_MALLOC(sizeof(SCRNDATA), "screen data"); + if (sd == NULL) { + goto ssg_err; + } + ZeroMemory(sd, sizeof(SCRNDATA)); + + memset(dirty, 1, SURFACE_HEIGHT); + + dat = sd->dat; + scrnsize = SURFACE_WIDTH * SURFACE_HEIGHT; + datanull = ((UINT8 *)dat) + (scrnsize * (sizeof(PALNUM) - 1)); + datatext = datanull; + datagrph = datanull; + if (gdcs.textdisp & 0x80) { + datatext = np2_tram; + } + if (gdcs.grphdisp & 0x80) { +#if defined(SUPPORT_PC9821) + if ((gdc.analog & 6) == 6) { + datagrph = np2_vram[0]; + } + else +#endif + datagrph = np2_vram[gdcs.disp]; + } +#if defined(SUPPORT_PC9821) + if (gdc.analog & 2) { + mix = screenmix4; + } + else +#endif + if (!(gdc.mode1 & 0x10)) { + mix = screenmix; + } + else if (!np2cfg.skipline) { + mix = screenmix2; + } + else { + mix = screenmix3; + } +#if defined(SUPPORT_VIDEOFILTER) + bVFEnable = VideoFilter_GetEnable(hVFMng1); + if(bVFEnable) { + VideoFilter_Import98(hVFMng1, datagrph, dirty, (gdc.analog & 2) ? TRUE : FALSE); + VideoFilter_Calc(hVFMng1); + } +#endif + (*mix)(sd->dat, datatext, datagrph); + +#if defined(SUPPORT_VIDEOFILTER) + sd->width = width; + sd->height = height; + sd->pals = 16777216; + sd->type = SCRNSAVE_24BIT; +#else + // γƒ‘γƒ¬γƒƒγƒˆζœ€ι©εŒ– + s = sd->dat; + pals = 0; + ZeroMemory(remap, sizeof(remap)); + ZeroMemory(remapflag, sizeof(remapflag)); + for (y=0; ypal[pos].d == curpal.d) { + break; + } + } + if (pos >= pals) { + sd->pal[pos].d = curpal.d; + pals++; + } + remap[col] = (PALNUM)pos; + } + s[x] = remap[col]; + } + s += SURFACE_WIDTH; + } + sd->width = width; + sd->height = height; + sd->pals = pals; + if (pals <= 2) { + sd->type = SCRNSAVE_1BIT; + } + else if (pals <= 16) { + sd->type = SCRNSAVE_4BIT; + } + else if (pals <= 256) { + sd->type = SCRNSAVE_8BIT; + } + else { + sd->type = SCRNSAVE_24BIT; + } +#endif + return((SCRNSAVE)sd); + +ssg_err: + return(NULL); +} + +/** + * Destroy + * @param[in] hdl The handle of saver + */ +void scrnsave_destroy(SCRNSAVE hdl) +{ + if (hdl) + { + _MFREE(hdl); + } +} + +/** + * Get BPP + * @param[in] hdl The handle of saver + * @return bpp + */ +int scrnsave_gettype(SCRNSAVE hdl) +{ + int ret = 0; + + if (hdl) + { + ret = hdl->type; + } + return ret; +} + +// ---- BMP + +BRESULT scrnsave_writebmp(SCRNSAVE hdl, const OEMCHAR *filename, UINT flag) { + +const SCRNDATA *sd; + FILEH fh; + BMPDATA bd; + UINT type; + UINT palsize; + BMPFILE bf; + UINT pos; + BMPINFO bi; + UINT8 palwork[1024]; + UINT align; + UINT8 *work; +const PALNUM *s; + int r; + int x; + BMPPAL curpal; + + (void)flag; + + if (hdl == NULL) { + goto sswb_err1; + } + sd = (SCRNDATA *)hdl; + + fh = file_create(filename); + if (fh == FILEH_INVALID) { + goto sswb_err1; + } + + bd.width = sd->width; + bd.height = sd->height; + if (sd->pals <= 2) { + type = SCRNSAVE_1BIT; + bd.bpp = 1; + palsize = 4 << 1; + } + else if (sd->pals <= 16) { + type = SCRNSAVE_4BIT; + bd.bpp = 4; + palsize = 4 << 4; + } + else if (sd->pals <= 256) { + type = SCRNSAVE_8BIT; + bd.bpp = 8; + palsize = 4 << 8; + } + else { + type = SCRNSAVE_24BIT; + bd.bpp = 24; + palsize = 0; + } + + // Bitmap File + ZeroMemory(&bf, sizeof(bf)); + bf.bfType[0] = 'B'; + bf.bfType[1] = 'M'; + pos = sizeof(BMPFILE) + sizeof(BMPINFO) + palsize; + STOREINTELDWORD(bf.bfOffBits, pos); + + // Bitmap Info + bmpdata_setinfo(&bi, &bd); + STOREINTELDWORD(bi.biClrImportant, sd->pals); + align = bmpdata_getalign(&bi); + + // Bitmap File (size) + STOREINTELDWORD(bf.bfSize, (sizeof(BMPFILE) + sizeof(BMPINFO) + palsize + bmpdata_getalign(&bi) * bd.height)); + + if (file_write(fh, &bf, sizeof(bf)) != sizeof(bf)) { + goto sswb_err2; + } + if (file_write(fh, &bi, sizeof(bi)) != sizeof(bi)) { + goto sswb_err2; + } + + if (palsize) { + ZeroMemory(palwork, palsize); + CopyMemory(palwork, sd->pal, sd->pals * 4); + if (file_write(fh, palwork, palsize) != palsize) { + goto sswb_err2; + } + } + + work = (UINT8 *)_MALLOC(align, filename); + if (work == NULL) { + goto sswb_err2; + } + ZeroMemory(work, align); + + s = sd->dat + (SURFACE_WIDTH * bd.height); + do { + s -= SURFACE_WIDTH; + switch(type) { + case SCRNSAVE_1BIT: + ZeroMemory(work, align); + for (x=0; x> 3] |= 0x80 >> (x & 7); + } + } + break; + + case SCRNSAVE_4BIT: + r = bd.width / 2; + for (x=0; xpal[s[x]].d; +#endif + work[x*3+0] = curpal.rgb[0]; + work[x*3+1] = curpal.rgb[1]; + work[x*3+2] = curpal.rgb[2]; + } + break; + } + if (file_write(fh, work, align) != align) { + goto sswb_err3; + } + } while(--bd.height); + + file_close(fh); + _MFREE(work); + return(SUCCESS); + +sswb_err3: + _MFREE(work); + +sswb_err2: + file_close(fh); + file_delete(filename); + +sswb_err1: + return(FAILURE); +} + +BRESULT scrnsave_getbmp(SCRNSAVE hdl, BMPFILE *lpbf, BMPINFO *lpbi, UINT8 **lplppal, UINT8 **lplppixels, UINT flag) { + +const SCRNDATA *sd; + BMPDATA bd; + UINT type; + UINT palsize; + BMPFILE bf; + UINT pos; + BMPINFO bi; + UINT8 palwork[1024]; + UINT align; + UINT8 *work; +const PALNUM *s; + int r; + int x; + BMPPAL curpal; + UINT8 *dstpix; + + (void)flag; + + if (hdl == NULL) { + goto sswb_err1; + } + sd = (SCRNDATA *)hdl; + + bd.width = sd->width; + bd.height = sd->height; + if (sd->pals <= 2) { + type = SCRNSAVE_1BIT; + bd.bpp = 1; + palsize = 4 << 1; + } + else if (sd->pals <= 16) { + type = SCRNSAVE_4BIT; + bd.bpp = 4; + palsize = 4 << 4; + } + else if (sd->pals <= 256) { + type = SCRNSAVE_8BIT; + bd.bpp = 8; + palsize = 4 << 8; + } + else { + type = SCRNSAVE_24BIT; + bd.bpp = 24; + palsize = 0; + } + + // Bitmap File + ZeroMemory(&bf, sizeof(bf)); + bf.bfType[0] = 'B'; + bf.bfType[1] = 'M'; + pos = sizeof(BMPFILE) + sizeof(BMPINFO) + palsize; + STOREINTELDWORD(bf.bfOffBits, pos); + + // Bitmap Info + bmpdata_setinfo(&bi, &bd); + STOREINTELDWORD(bi.biClrImportant, sd->pals); + align = bmpdata_getalign(&bi); + CopyMemory(lpbi, &bi, sizeof(bi)); + *lplppal = (UINT8*)malloc(palsize); + if (palsize) { + ZeroMemory(palwork, palsize); + CopyMemory(palwork, sd->pal, sd->pals * 4); + CopyMemory(*lplppal, palwork, palsize); + } + + // Bitmap File (size) + STOREINTELDWORD(bf.bfSize, (sizeof(BMPFILE) + sizeof(BMPINFO) + palsize + bmpdata_getalign(&bi) * bd.height)); + CopyMemory(lpbf, &bf, sizeof(bf)); + + work = (UINT8 *)_MALLOC(align, filename); + if (work == NULL) { + goto sswb_err2; + } + ZeroMemory(work, align); + + *lplppixels = (UINT8*)malloc(bmpdata_getalign(&bi) * bd.height); + dstpix = *lplppixels; + s = sd->dat + (SURFACE_WIDTH * bd.height); + do { + s -= SURFACE_WIDTH; + switch(type) { + case SCRNSAVE_1BIT: + ZeroMemory(work, align); + for (x=0; x> 3] |= 0x80 >> (x & 7); + } + } + break; + + case SCRNSAVE_4BIT: + r = bd.width / 2; + for (x=0; xpal[s[x]].d; + work[x*3+0] = curpal.rgb[0]; + work[x*3+1] = curpal.rgb[1]; + work[x*3+2] = curpal.rgb[2]; + + } + break; + } + + CopyMemory(dstpix, work, align); + dstpix += align; + } while(--bd.height); + + + _MFREE(work); + return(SUCCESS); + +//sswb_err3: +// _MFREE(work); +sswb_err2: +sswb_err1: + return(FAILURE); +} + + +// ---- GIF + +#if 1 +#define MAXGIFBITS 12 + +#if MAXGIFBITS == 12 +#define HASHTBLSIZE 5003 +#elif MAXGIFBITS == 13 +#define HASHTBLSIZE 9001 +#elif MAXGIFBITS == 14 +#define HASHTBLSIZE 18013 +#elif MAXGIFBITS == 15 +#define HASHTBLSIZE 35023 +#elif MAXGIFBITS == 16 +#define HASHTBLSIZE 69001 +#endif + +#define GIFBITDATAWRITE(dat) \ + do { \ + bitdata |= (dat) << bits; \ + bits += bitcount; \ + while(bits >= 8) { \ + bitbuf[++bitdatas] = (UINT8)bitdata; \ + if (bitdatas >= 255) { \ + bitbuf[0] = (UINT8)bitdatas; \ + r = 1 + bitdatas; \ + if (file_write(fh, bitbuf, r) != r) { \ + goto sswg_err4; \ + } \ + bitdatas = 0; \ + } \ + bitdata >>= 8; \ + bits -= 8; \ + } \ + } while(/*CONSTCOND*/ 0) + +#define GIFBITEXTENSION \ + do { \ + if (codefree > codemax) { \ + bitcount++; \ + if (bitcount < MAXGIFBITS) { \ + codemax = (codemax << 1) + 1; \ + } \ + else { \ + codemax = 1 << MAXGIFBITS; \ + } \ + } \ + } while(/*CONSTCOND*/ 0) + +#define GIFBITDATAFLASH \ + do { \ + if (bits) { \ + bitbuf[++bitdatas] = (UINT8)bitdata; \ + } \ + if (bitdatas) { \ + bitbuf[0] = (UINT8)bitdatas; \ + r = 1 + bitdatas; \ + if (file_write(fh, bitbuf, r) != r) { \ + goto sswg_err4; \ + } \ + } \ + } while(/*CONSTCOND*/ 0) + + +BRESULT scrnsave_writegif(SCRNSAVE hdl, const OEMCHAR *filename, UINT flag) { + +const SCRNDATA *sd; + UINT bpp; + UINT *hash_code; + UINT32 *hash_data; + FILEH fh; + UINT r; +const PALNUM *s; + + UINT codeclear; + UINT codeeoi; + UINT codefree; + UINT codemax; + + UINT8 bits; + UINT8 bitcount; + UINT bitdata; + UINT bitdatas; + UINT8 bitbuf[3+256*3]; + + int x; + int y; + UINT b; + UINT32 c; + int i; + int disp; + + (void)flag; + + if (hdl == NULL) { + goto sswg_err1; + } + sd = (SCRNDATA *)hdl; + + bpp = 1; + while(sd->pals > (UINT)(1 << bpp)) { + bpp++; + } + if (bpp > 8) { + goto sswg_err1; + } + + hash_code = (UINT *)_MALLOC(HASHTBLSIZE * sizeof(UINT), "hash_code"); + if (hash_code == NULL) { + goto sswg_err1; + } + hash_data = (UINT32 *)_MALLOC(HASHTBLSIZE * sizeof(UINT32), "hash_data"); + if (hash_data == NULL) { + goto sswg_err2; + } + + fh = file_create(filename); + if (fh == FILEH_INVALID) { + goto sswg_err3; + } + + CopyMemory(bitbuf, "GIF87a", 6); + STOREINTELWORD(bitbuf + 6, sd->width); + STOREINTELWORD(bitbuf + 8, sd->height); + if (file_write(fh, bitbuf, 10) != 10) { + goto sswg_err4; + } + + ZeroMemory(bitbuf, sizeof(bitbuf)); + bitbuf[0] = (UINT8)(0x80 + ((8 - 1) << 4) + (bpp - 1)); +// bitbuf[1] = 0; // background +// bitbuf[2] = 0; // reserved + for (r=0; rpals; r++) { + bitbuf[r*3+3] = sd->pal[r].rgb[2]; // R + bitbuf[r*3+4] = sd->pal[r].rgb[1]; // G + bitbuf[r*3+5] = sd->pal[r].rgb[0]; // B + } + r = (1 << bpp) * 3 + 3; + if (file_write(fh, bitbuf, r) != r) { + goto sswg_err4; + } + + bitbuf[0] = 0x2c; // separator + STOREINTELWORD(bitbuf + 1, 0); // sx + STOREINTELWORD(bitbuf + 3, 0); // sy + STOREINTELWORD(bitbuf + 5, sd->width); // cx + STOREINTELWORD(bitbuf + 7, sd->height); // cy + bitbuf[9] = 0; // noninterlace + + bpp = MAX(bpp, 2); + bitbuf[10] = (UINT8)bpp; + if (file_write(fh, bitbuf, 11) != 11) { + goto sswg_err4; + } + + codeclear = 1 << bpp; + codeeoi = codeclear + 1; + codefree = codeclear + 2; + codemax = (codeclear << 1) - 1; + + bits = 0; + bitdata = 0; + bitdatas = 0; + bitcount = (UINT8)(bpp + 1); + GIFBITDATAWRITE(codeclear); + + ZeroMemory(hash_code, HASHTBLSIZE * sizeof(UINT)); + + x = 0; + y = 0; + s = sd->dat; + b = s[x++]; + do { + while(x < sd->width) { + c = s[x++]; + i = (c << (MAXGIFBITS - 8)) + b; + c = (c << 16) + b; + if (i >= HASHTBLSIZE) { + i -= HASHTBLSIZE; + } + disp = (i != 0)?(i - HASHTBLSIZE):-1; + while(1) { + if (hash_code[i] == 0) { + GIFBITDATAWRITE(b); + GIFBITEXTENSION; + if (codefree < (1 << MAXGIFBITS)) { + hash_code[i] = codefree++; + hash_data[i] = c; + } + else { + ZeroMemory(hash_code, HASHTBLSIZE * sizeof(UINT)); + GIFBITDATAWRITE(codeclear); + codefree = codeclear + 2; + codemax = (codeclear << 1) - 1; + bitcount = (UINT8)(bpp + 1); + } + b = c >> 16; + break; + } + else if (hash_data[i] == c) { + b = hash_code[i]; + break; + } + else { + i += disp; + if (i < 0) { + i += HASHTBLSIZE; + } + } + } + } + x = 0; + s += SURFACE_WIDTH; + y++; + } while(y < sd->height); + + GIFBITDATAWRITE(b); + GIFBITEXTENSION; + GIFBITDATAWRITE(codeeoi); + GIFBITDATAFLASH; + + bitbuf[0] = 0; + if (file_write(fh, bitbuf, 1) != 1) { + goto sswg_err4; + } + + bitbuf[0] = 0x3b; // terminator + if (file_write(fh, bitbuf, 1) != 1) { + goto sswg_err4; + } + + file_close(fh); + _MFREE(hash_data); + _MFREE(hash_code); + return(SUCCESS); + +sswg_err4: + file_close(fh); + file_delete(filename); + +sswg_err3: + _MFREE(hash_data); + +sswg_err2: + _MFREE(hash_code); + +sswg_err1: + return(FAILURE); +} +#endif + diff --git a/vram/scrnsave.h b/vram/scrnsave.h old mode 100644 new mode 100755 index 48ad29a4..0bf87f9f --- a/vram/scrnsave.h +++ b/vram/scrnsave.h @@ -1,45 +1,47 @@ -/** - * @file scrnsave.h - * @brief Interface of the screen saver - */ - -#pragma once - -/** - * types - */ -enum tagScrnSaveType -{ - SCRNSAVE_1BIT = 0, - SCRNSAVE_4BIT = 1, - SCRNSAVE_8BIT = 2, - SCRNSAVE_24BIT = 3 -}; - -/** - * flags - */ -enum tagScrnSaveFlags -{ - SCRNSAVE_AUTO = 0 -}; - -struct tagScrnSave; -typedef struct tagScrnSave * SCRNSAVE; - - -#ifdef __cplusplus -extern "C" -{ -#endif - -SCRNSAVE scrnsave_create(void); -void scrnsave_destroy(SCRNSAVE hdl); -int scrnsave_gettype(SCRNSAVE hdl); -BRESULT scrnsave_writebmp(SCRNSAVE hdl, const OEMCHAR *filename, UINT flag); -BRESULT scrnsave_getbmp(SCRNSAVE hdl, BMPFILE *lpbf, BMPINFO *lpbi, UINT8 **lplppal, UINT8 **lplppixels, UINT flag); -BRESULT scrnsave_writegif(SCRNSAVE hdl, const OEMCHAR *filename, UINT flag); - -#ifdef __cplusplus -} -#endif +/** + * @file scrnsave.h + * @brief Interface of the screen saver + */ + +#pragma once + +#include + +/** + * types + */ +enum tagScrnSaveType +{ + SCRNSAVE_1BIT = 0, + SCRNSAVE_4BIT = 1, + SCRNSAVE_8BIT = 2, + SCRNSAVE_24BIT = 3 +}; + +/** + * flags + */ +enum tagScrnSaveFlags +{ + SCRNSAVE_AUTO = 0 +}; + +struct tagScrnSave; +typedef struct tagScrnSave * SCRNSAVE; + + +#ifdef __cplusplus +extern "C" +{ +#endif + +SCRNSAVE scrnsave_create(void); +void scrnsave_destroy(SCRNSAVE hdl); +int scrnsave_gettype(SCRNSAVE hdl); +BRESULT scrnsave_writebmp(SCRNSAVE hdl, const OEMCHAR *filename, UINT flag); +BRESULT scrnsave_getbmp(SCRNSAVE hdl, BMPFILE *lpbf, BMPINFO *lpbi, UINT8 **lplppal, UINT8 **lplppixels, UINT flag); +BRESULT scrnsave_writegif(SCRNSAVE hdl, const OEMCHAR *filename, UINT flag); + +#ifdef __cplusplus +} +#endif diff --git a/vram/sdraw.c b/vram/sdraw.c old mode 100644 new mode 100755 index c0307366..605babfd --- a/vram/sdraw.c +++ b/vram/sdraw.c @@ -1,166 +1,174 @@ -#include "compiler.h" -#include "scrnmng.h" -#include "scrndraw.h" -#include "sdraw.h" -#include "palettes.h" - -#if !defined(SIZE_QVGA) || defined(SIZE_VGATEST) - -#if defined(SUPPORT_8BPP) -#define SDSYM(sym) sdraw8##sym -#define SDSETPIXEL(ptr, pal) *(ptr) = (pal) + START_PAL -#include "sdraw.mcr" -#undef SDSYM -#undef SDSETPIXEL -#endif - -#if defined(SUPPORT_16BPP) -#define SDSYM(sym) sdraw16##sym -#define SDSETPIXEL(ptr, pal) *(UINT16 *)(ptr) = np2_pal16[(pal)] -#include "sdraw.mcr" -#include "sdrawex.mcr" -#undef SDSYM -#undef SDSETPIXEL -#endif - -#if defined(SUPPORT_24BPP) -#define SDSYM(sym) sdraw24##sym -#define SDSETPIXEL(ptr, pal) (ptr)[RGB24_R] = np2_pal32[(pal)].p.r; \ - (ptr)[RGB24_G] = np2_pal32[(pal)].p.g; \ - (ptr)[RGB24_B] = np2_pal32[(pal)].p.b -#include "sdraw.mcr" -#include "sdrawex.mcr" -#undef SDSYM -#undef SDSETPIXEL -#endif - -#if defined(SUPPORT_32BPP) -#define SDSYM(sym) sdraw32##sym -#define SDSETPIXEL(ptr, pal) *(UINT32 *)(ptr) = np2_pal32[(pal)].d -#include "sdraw.mcr" -#include "sdrawex.mcr" -#undef SDSYM -#undef SDSETPIXEL -#endif - - -// ---- - -static const SDRAWFN *tbl[] = { -#if defined(SUPPORT_8BPP) - sdraw8p, -#else - NULL, -#endif -#if defined(SUPPORT_16BPP) - sdraw16p, -#else - NULL, -#endif -#if defined(SUPPORT_24BPP) - sdraw24p, -#else - NULL, -#endif -#if defined(SUPPORT_32BPP) - sdraw32p, -#else - NULL, -#endif - -#if defined(SUPPORT_NORMALDISP) -#if defined(SUPPORT_8BPP) - sdraw8n, -#else - NULL, -#endif -#if defined(SUPPORT_16BPP) - sdraw16n, -#else - NULL, -#endif -#if defined(SUPPORT_24BPP) - sdraw24n, -#else - NULL, -#endif -#if defined(SUPPORT_32BPP) - sdraw32n, -#else - NULL, -#endif -#endif -}; - -const SDRAWFN *sdraw_getproctbl(const SCRNSURF *surf) { - - int proc; - - proc = ((surf->bpp >> 3) - 1) & 3; -#if defined(SUPPORT_NORMALDISP) - if (surf->extend) { - proc += 4; - } -#endif - return(tbl[proc]); -} - - -// ---- PC-9821 - -#if defined(SUPPORT_PC9821) - -static const SDRAWFN *tblex[] = { - NULL, -#if defined(SUPPORT_16BPP) - sdraw16pex, -#else - NULL, -#endif -#if defined(SUPPORT_24BPP) - sdraw24pex, -#else - NULL, -#endif -#if defined(SUPPORT_32BPP) - sdraw32pex, -#else - NULL, -#endif - -#if defined(SUPPORT_NORMALDISP) - NULL, -#if defined(SUPPORT_16BPP) - sdraw16nex, -#else - NULL, -#endif -#if defined(SUPPORT_24BPP) - sdraw24nex, -#else - NULL, -#endif -#if defined(SUPPORT_32BPP) - sdraw32nex, -#else - NULL, -#endif -#endif -}; - -const SDRAWFN *sdraw_getproctblex(const SCRNSURF *surf) { - - int proc; - - proc = ((surf->bpp >> 3) - 1) & 3; -#if defined(SUPPORT_NORMALDISP) - if (surf->extend) { - proc += 4; - } -#endif - return(tblex[proc]); -} -#endif - -#endif - +#include +#include +#include +#include "sdraw.h" +#include +#if defined(SUPPORT_VIDEOFILTER) +#include +#endif + +#if defined(SUPPORT_VIDEOFILTER) +BOOL bVFEnable; +BOOL bVFImport; +#endif + +#if !defined(NP2_SIZE_QVGA) || defined(SIZE_VGATEST) + +#if defined(SUPPORT_8BPP) +#define SDSYM(sym) sdraw8##sym +#define SDSETPIXEL(ptr, pal) *(ptr) = (pal) + START_PAL +#include "sdraw.mcr" +#undef SDSYM +#undef SDSETPIXEL +#endif + +#if defined(SUPPORT_16BPP) +#define SDSYM(sym) sdraw16##sym +#define SDSETPIXEL(ptr, pal) *(UINT16 *)(ptr) = np2_pal16[(pal)] +#include "sdraw.mcr" +#include "sdrawex.mcr" +#undef SDSYM +#undef SDSETPIXEL +#endif + +#if defined(SUPPORT_24BPP) +#define SDSYM(sym) sdraw24##sym +#define SDSETPIXEL(ptr, pal) (ptr)[RGB24_R] = np2_pal32[(pal)].p.r; \ + (ptr)[RGB24_G] = np2_pal32[(pal)].p.g; \ + (ptr)[RGB24_B] = np2_pal32[(pal)].p.b +#include "sdraw.mcr" +#include "sdrawex.mcr" +#undef SDSYM +#undef SDSETPIXEL +#endif + +#if defined(SUPPORT_32BPP) +#define SDSYM(sym) sdraw32##sym +#define SDSETPIXEL(ptr, pal) *(UINT32 *)(ptr) = np2_pal32[(pal)].d +#include "sdraw.mcr" +#include "sdrawex.mcr" +#undef SDSYM +#undef SDSETPIXEL +#endif + + +// ---- + +static const SDRAWFN *tbl[] = { +#if defined(SUPPORT_8BPP) + sdraw8p, +#else + NULL, +#endif +#if defined(SUPPORT_16BPP) + sdraw16p, +#else + NULL, +#endif +#if defined(SUPPORT_24BPP) + sdraw24p, +#else + NULL, +#endif +#if defined(SUPPORT_32BPP) + sdraw32p, +#else + NULL, +#endif + +#if defined(SUPPORT_NORMALDISP) +#if defined(SUPPORT_8BPP) + sdraw8n, +#else + NULL, +#endif +#if defined(SUPPORT_16BPP) + sdraw16n, +#else + NULL, +#endif +#if defined(SUPPORT_24BPP) + sdraw24n, +#else + NULL, +#endif +#if defined(SUPPORT_32BPP) + sdraw32n, +#else + NULL, +#endif +#endif +}; + +const SDRAWFN *sdraw_getproctbl(const SCRNSURF *surf) { + + int proc; + + proc = ((surf->bpp >> 3) - 1) & 3; +#if defined(SUPPORT_NORMALDISP) + if (surf->extend) { + proc += 4; + } +#endif + return(tbl[proc]); +} + + +// ---- PC-9821 + +#if defined(SUPPORT_PC9821) + +static const SDRAWFN *tblex[] = { + NULL, +#if defined(SUPPORT_16BPP) + sdraw16pex, +#else + NULL, +#endif +#if defined(SUPPORT_24BPP) + sdraw24pex, +#else + NULL, +#endif +#if defined(SUPPORT_32BPP) + sdraw32pex, +#else + NULL, +#endif + +#if defined(SUPPORT_NORMALDISP) + NULL, +#if defined(SUPPORT_16BPP) + sdraw16nex, +#else + NULL, +#endif +#if defined(SUPPORT_24BPP) + sdraw24nex, +#else + NULL, +#endif +#if defined(SUPPORT_32BPP) + sdraw32nex, +#else + NULL, +#endif +#endif +}; + +const SDRAWFN *sdraw_getproctblex(const SCRNSURF *surf) { + + int proc; + + proc = ((surf->bpp >> 3) - 1) & 3; +#if defined(SUPPORT_NORMALDISP) + if (surf->extend) { + proc += 4; + } +#endif + return(tblex[proc]); +} +#endif + +#endif + diff --git a/vram/sdraw.h b/vram/sdraw.h old mode 100644 new mode 100755 index 3dcd69c2..e2355229 --- a/vram/sdraw.h +++ b/vram/sdraw.h @@ -1,30 +1,38 @@ - -typedef struct { -const UINT8 *src; -const UINT8 *src2; - UINT8 *dst; - int width; - int xbytes; - int y; - int xalign; - int yalign; - UINT8 dirty[SURFACE_HEIGHT]; -} _SDRAW, *SDRAW; - -typedef void (SCRNCALL * SDRAWFN)(SDRAW sdraw, int maxy); - - -#ifdef __cplusplus -extern "C" { -#endif - -const SDRAWFN *sdraw_getproctbl(const SCRNSURF *surf); - -#if defined(SUPPORT_PC9821) -const SDRAWFN *sdraw_getproctblex(const SCRNSURF *surf); -#endif - -#ifdef __cplusplus -} -#endif - + +#include +#include + +typedef struct { +const UINT8 *src; +const UINT8 *src2; + UINT8 *dst; + int width; + int xbytes; + int y; + int xalign; + int yalign; + UINT8 dirty[SURFACE_HEIGHT]; +} _SDRAW, *SDRAW; + +typedef void (SCRNCALL * SDRAWFN)(SDRAW sdraw, int maxy); + + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(SUPPORT_VIDEOFILTER) +extern BOOL bVFEnable; +extern BOOL bVFImport; +#endif + +const SDRAWFN *sdraw_getproctbl(const SCRNSURF *surf); + +#if defined(SUPPORT_PC9821) +const SDRAWFN *sdraw_getproctblex(const SCRNSURF *surf); +#endif + +#ifdef __cplusplus +} +#endif + diff --git a/vram/sdraw.mcr b/vram/sdraw.mcr old mode 100644 new mode 100755 index 3c626602..f040511c --- a/vram/sdraw.mcr +++ b/vram/sdraw.mcr @@ -1,863 +1,1054 @@ - -// ---- plasma display - -// vram off -static void SCRNCALL SDSYM(p_0)(SDRAW sdraw, int maxy) { - - UINT8 *p; - int y; - int x; - - p = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x++) { - SDSETPIXEL(p, NP2PAL_TEXT2); - p += sdraw->xalign; - } - p -= sdraw->xbytes; - } - p += sdraw->yalign; - } while(++y < maxy); - - sdraw->dst = p; - sdraw->y = y; -} - -// text or grph 1ƒvƒŒ[ƒ“ -static void SCRNCALL SDSYM(p_1)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int y; - int x; - - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x++) { - SDSETPIXEL(q, p[x] + NP2PAL_GRPH); - q += sdraw->xalign; - } - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - } while(++y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// text + grph -static void SCRNCALL SDSYM(p_2)(SDRAW sdraw, int maxy) { - -const UINT8 *p; -const UINT8 *q; - UINT8 *r; - int y; - int x; - - p = sdraw->src; - q = sdraw->src2; - r = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x++) { - SDSETPIXEL(r, p[x] + q[x] + NP2PAL_GRPH); - r += sdraw->xalign; - } - r -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += SURFACE_WIDTH; - r += sdraw->yalign; - } while(++y < maxy); - - sdraw->src = p; - sdraw->src2 = q; - sdraw->dst = r; - sdraw->y = y; -} - -// text + (grph:interleave) -static void SCRNCALL SDSYM(p_ti)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int y; - int x; - - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x++) { - SDSETPIXEL(q, p[x] + NP2PAL_GRPH); - q += sdraw->xalign; - } - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - - if (sdraw->dirty[y+1]) { - for (x=0; xwidth; x++) { - SDSETPIXEL(q, (p[x] >> 4) + NP2PAL_TEXT); - q += sdraw->xalign; - } - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// grph:interleave -static void SCRNCALL SDSYM(p_gi)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int y; - int x; - - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x++) { - SDSETPIXEL(q, p[x] + NP2PAL_GRPH); - q += sdraw->xalign; - } - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - - if (sdraw->dirty[y+1]) { - for (x=0; xwidth; x++) { - SDSETPIXEL(q, NP2PAL_TEXT); - q += sdraw->xalign; - } - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// text + grph:interleave -static void SCRNCALL SDSYM(p_2i)(SDRAW sdraw, int maxy) { - -const UINT8 *p; -const UINT8 *q; - UINT8 *r; - int y; - int x; - - p = sdraw->src; - q = sdraw->src2; - r = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x++) { - SDSETPIXEL(r, p[x] + q[x] + NP2PAL_GRPH); - r += sdraw->xalign; - } - r -= sdraw->xbytes; - } - q += SURFACE_WIDTH; - r += sdraw->yalign; - - if (sdraw->dirty[y+1]) { - for (x=0; xwidth; x++) { - SDSETPIXEL(r, (q[x] >> 4) + NP2PAL_TEXT); - r += sdraw->xalign; - } - r -= sdraw->xbytes; - } - p += (SURFACE_WIDTH * 2); - q += SURFACE_WIDTH; - r += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->src2 = q; - sdraw->dst = r; - sdraw->y = y; -} - -// grph:interleave ex -static void SCRNCALL SDSYM(p_gie)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int y; - int x; - - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - sdraw->dirty[y+1] |= 0xff; - for (x=0; xwidth; x++) { - SDSETPIXEL(q, p[x] + NP2PAL_GRPH); - q += sdraw->xalign; - } - q -= sdraw->xbytes; - } - q += sdraw->yalign; - - if (sdraw->dirty[y+1]) { - for (x=0; xwidth; x++) { - SDSETPIXEL(q, p[x] + NP2PAL_SKIP); - q += sdraw->xalign; - } - q -= sdraw->xbytes; - } - p += (SURFACE_WIDTH * 2); - q += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// text + grph:interleave ex -static void SCRNCALL SDSYM(p_2ie)(SDRAW sdraw, int maxy) { - -const UINT8 *p; -const UINT8 *q; - UINT8 *r; - int y; - int x; - UINT8 c; - - p = sdraw->src; - q = sdraw->src2; - r = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - sdraw->dirty[y+1] |= 0xff; - for (x=0; xwidth; x++) { - SDSETPIXEL(r, p[x] + q[x] + NP2PAL_GRPH); - r += sdraw->xalign; - } - r -= sdraw->xbytes; - } - q += SURFACE_WIDTH; - r += sdraw->yalign; - - if (sdraw->dirty[y+1]) { - for (x=0; xwidth; x++) { - c = q[x] >> 4; - if (!c) { - c = p[x] + NP2PALS_TXT; - } - SDSETPIXEL(r, c + NP2PAL_TEXT); - r += sdraw->xalign; - } - r -= sdraw->xbytes; - } - p += (SURFACE_WIDTH * 2); - q += SURFACE_WIDTH; - r += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->src2 = q; - sdraw->dst = r; - sdraw->y = y; -} - -#if defined(SUPPORT_CRT15KHZ) -// text or grph 1ƒvƒŒ[ƒ“(15kHz) -static void SCRNCALL SDSYM(p_1d)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int a; - int y; - int x; - int c; - - p = sdraw->src; - q = sdraw->dst; - a = sdraw->yalign; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x++) { - c = p[x] + NP2PAL_GRPH; - SDSETPIXEL(q, c); - SDSETPIXEL((q + a), c); - q += sdraw->xalign; - } - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += a * 2; - } while(++y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// text + grph (15kHz) -static void SCRNCALL SDSYM(p_2d)(SDRAW sdraw, int maxy) { - -const UINT8 *p; -const UINT8 *q; - UINT8 *r; - int a; - int y; - int x; - int c; - - p = sdraw->src; - q = sdraw->src2; - r = sdraw->dst; - a = sdraw->yalign; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x++) { - c = p[x] + q[x] + NP2PAL_GRPH; - SDSETPIXEL(r, c); - SDSETPIXEL((r + a), c); - r += sdraw->xalign; - } - r -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += SURFACE_WIDTH; - r += a * 2; - } while(++y < maxy); - - sdraw->src = p; - sdraw->src2 = q; - sdraw->dst = r; - sdraw->y = y; -} -#endif - -static const SDRAWFN SDSYM(p)[] = { - SDSYM(p_0), SDSYM(p_1), SDSYM(p_1), SDSYM(p_2), - SDSYM(p_0), SDSYM(p_ti), SDSYM(p_gi), SDSYM(p_2i), - SDSYM(p_0), SDSYM(p_ti), SDSYM(p_gie), SDSYM(p_2ie), -#if defined(SUPPORT_CRT15KHZ) - SDSYM(p_0), SDSYM(p_1d), SDSYM(p_1d), SDSYM(p_2d), -#endif - }; - -// ---- normal display - -#ifdef SUPPORT_NORMALDISP - -// vram off -static void SCRNCALL SDSYM(n_0)(SDRAW sdraw, int maxy) { - - UINT8 *p; - int y; - int x; - - p = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - SDSETPIXEL(p, NP2PAL_TEXT3); - for (x=0; xwidth; x++) { - p += sdraw->xalign; - SDSETPIXEL(p, NP2PAL_TEXT2); - } - p -= sdraw->xbytes; - } - p += sdraw->yalign; - } while(++y < maxy); - - sdraw->dst = p; - sdraw->y = y; -} - -// text 1ƒvƒŒ[ƒ“ -static void SCRNCALL SDSYM(n_t)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int y; - int x; - - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - SDSETPIXEL(q, (p[0] >> 4) + NP2PAL_TEXT3); - q += sdraw->xalign; - for (x=1; xwidth; x++) { - SDSETPIXEL(q, p[x] + NP2PAL_GRPH); - q += sdraw->xalign; - } - SDSETPIXEL(q, NP2PAL_TEXT2); - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - } while(++y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// grph 1ƒvƒŒ[ƒ“ -static void SCRNCALL SDSYM(n_g)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int y; - int x; - - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - SDSETPIXEL(q, NP2PAL_TEXT3); - for (x=0; xwidth; x++) { - q += sdraw->xalign; - SDSETPIXEL(q, p[x] + NP2PAL_GRPH); - } - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - } while(++y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// text + grph -static void SCRNCALL SDSYM(n_2)(SDRAW sdraw, int maxy) { - -const UINT8 *p; -const UINT8 *q; - UINT8 *r; - int y; - int x; - - p = sdraw->src; - q = sdraw->src2; - r = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - SDSETPIXEL(r, (q[0] >> 4) + NP2PAL_TEXT3); - r += sdraw->xalign; - for (x=1; xwidth; x++) { - SDSETPIXEL(r, p[x-1] + q[x] + NP2PAL_GRPH); - r += sdraw->xalign; - } - SDSETPIXEL(r, p[x-1] + NP2PAL_GRPH); - r -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += SURFACE_WIDTH; - r += sdraw->yalign; - } while(++y < maxy); - - sdraw->src = p; - sdraw->src2 = q; - sdraw->dst = r; - sdraw->y = y; -} - -// text + (grph:interleave) -static void SCRNCALL SDSYM(n_ti)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int y; - int x; - - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - SDSETPIXEL(q, (p[0] >> 4) + NP2PAL_TEXT3); - q += sdraw->xalign; - for (x=1; xwidth; x++) { - SDSETPIXEL(q, p[x] + NP2PAL_GRPH); - q += sdraw->xalign; - } - SDSETPIXEL(q, NP2PAL_GRPH); - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - - if (sdraw->dirty[y+1]) { - SDSETPIXEL(q, (p[0] >> 4) + NP2PAL_TEXT3); - q += sdraw->xalign; - for (x=1; xwidth; x++) { - SDSETPIXEL(q, (p[x] >> 4) + NP2PAL_TEXT); - q += sdraw->xalign; - } - SDSETPIXEL(q, NP2PAL_TEXT); - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// grph:interleave -static void SCRNCALL SDSYM(n_gi)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int y; - int x; - - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - SDSETPIXEL(q, NP2PAL_TEXT3); - for (x=0; xwidth; x++) { - q += sdraw->xalign; - SDSETPIXEL(q, p[x] + NP2PAL_GRPH); - } - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - - if (sdraw->dirty[y+1]) { - SDSETPIXEL(q, NP2PAL_TEXT3); - for (x=0; xwidth; x++) { - q += sdraw->xalign; - SDSETPIXEL(q, NP2PAL_TEXT); - } - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// text + grph:interleave -static void SCRNCALL SDSYM(n_2i)(SDRAW sdraw, int maxy) { - -const UINT8 *p; -const UINT8 *q; - UINT8 *r; - int y; - int x; - - p = sdraw->src; - q = sdraw->src2; - r = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - SDSETPIXEL(r, (q[0] >> 4) + NP2PAL_TEXT3); - r += sdraw->xalign; - for (x=1; xwidth; x++) { - SDSETPIXEL(r, p[x-1] + q[x] + NP2PAL_GRPH); - r += sdraw->xalign; - } - SDSETPIXEL(r, p[x-1] + NP2PAL_GRPH); - r -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += SURFACE_WIDTH; - r += sdraw->yalign; - - if (sdraw->dirty[y+1]) { - SDSETPIXEL(r, (q[0] >> 4) + NP2PAL_TEXT3); - r += sdraw->xalign; - for (x=1; xwidth; x++) { - SDSETPIXEL(r, (q[x] >> 4) + NP2PAL_TEXT); - r += sdraw->xalign; - } - SDSETPIXEL(r, NP2PAL_TEXT); - r -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += SURFACE_WIDTH; - r += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->src2 = q; - sdraw->dst = r; - sdraw->y = y; -} - -// grph:interleave ex -static void SCRNCALL SDSYM(n_gie)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int y; - int x; - - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - sdraw->dirty[y+1] |= 0xff; - SDSETPIXEL(q, NP2PAL_TEXT3); - for (x=0; xwidth; x++) { - q += sdraw->xalign; - SDSETPIXEL(q, p[x] + NP2PAL_GRPH); - } - q -= sdraw->xbytes; - } - q += sdraw->yalign; - - if (sdraw->dirty[y+1]) { - SDSETPIXEL(q, NP2PAL_TEXT3); - for (x=0; xwidth; x++) { - q += sdraw->xalign; - SDSETPIXEL(q, p[x] + NP2PAL_SKIP); - } - q -= sdraw->xbytes; - } - p += (SURFACE_WIDTH * 2); - q += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// text + grph:interleave ex -static void SCRNCALL SDSYM(n_2ie)(SDRAW sdraw, int maxy) { - -const UINT8 *p; -const UINT8 *q; - UINT8 *r; - int y; - int x; - UINT8 c; - - p = sdraw->src; - q = sdraw->src2; - r = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - sdraw->dirty[y+1] |= 0xff; - SDSETPIXEL(r, (q[0] >> 4) + NP2PAL_TEXT3); - r += sdraw->xalign; - for (x=1; xwidth; x++) { - SDSETPIXEL(r, p[x-1] + q[x] + NP2PAL_GRPH); - r += sdraw->xalign; - } - SDSETPIXEL(r, p[x-1] + NP2PAL_GRPH); - r -= sdraw->xbytes; - } - q += SURFACE_WIDTH; - r += sdraw->yalign; - - if (sdraw->dirty[y+1]) { - SDSETPIXEL(r, (q[0] >> 4) + NP2PAL_TEXT3); - r += sdraw->xalign; - for (x=1; xwidth; x++) { - c = q[x] >> 4; - if (!c) { - c = p[x-1] + NP2PALS_TXT; - } - SDSETPIXEL(r, c + NP2PAL_TEXT); - r += sdraw->xalign; - } - SDSETPIXEL(r, p[x-1] + NP2PAL_SKIP); - r -= sdraw->xbytes; - } - p += (SURFACE_WIDTH * 2); - q += SURFACE_WIDTH; - r += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->src2 = q; - sdraw->dst = r; - sdraw->y = y; -} - -#if defined(SUPPORT_CRT15KHZ) -// text 1ƒvƒŒ[ƒ“ (15kHz) -static void SCRNCALL SDSYM(n_td)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int a; - int y; - int x; - int c; - - p = sdraw->src; - q = sdraw->dst; - a = sdraw->yalign; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - c = (p[0] >> 4) + NP2PAL_TEXT3; - SDSETPIXEL(q, c); - SDSETPIXEL((q + a), c); - q += sdraw->xalign; - for (x=1; xwidth; x++) { - c = p[x] + NP2PAL_GRPH; - SDSETPIXEL(q, c); - SDSETPIXEL((q + a), c); - q += sdraw->xalign; - } - SDSETPIXEL(q, NP2PAL_TEXT2); - SDSETPIXEL((q + a), NP2PAL_TEXT2); - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += a * 2; - } while(++y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// grph 1ƒvƒŒ[ƒ“ (15kHz) -static void SCRNCALL SDSYM(n_gd)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int a; - int y; - int x; - int c; - - p = sdraw->src; - q = sdraw->dst; - a = sdraw->yalign; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - SDSETPIXEL(q, NP2PAL_TEXT3); - SDSETPIXEL((q + a), NP2PAL_TEXT3); - for (x=0; xwidth; x++) { - q += sdraw->xalign; - c = p[x] + NP2PAL_GRPH; - SDSETPIXEL(q, c); - SDSETPIXEL((q + a), c); - } - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += a * 2; - } while(++y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// text + grph (15kHz) -static void SCRNCALL SDSYM(n_2d)(SDRAW sdraw, int maxy) { - -const UINT8 *p; -const UINT8 *q; - UINT8 *r; - int a; - int y; - int x; - int c; - - p = sdraw->src; - q = sdraw->src2; - r = sdraw->dst; - a = sdraw->yalign; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - c = (q[0] >> 4) + NP2PAL_TEXT3; - SDSETPIXEL(r, c); - SDSETPIXEL((r + a), c); - r += sdraw->xalign; - for (x=1; xwidth; x++) { - c = p[x-1] + q[x] + NP2PAL_GRPH; - SDSETPIXEL(r, c); - SDSETPIXEL((r + a), c); - r += sdraw->xalign; - } - c = p[x-1] + NP2PAL_GRPH; - SDSETPIXEL(r, c); - SDSETPIXEL((r + a), c); - r -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += SURFACE_WIDTH; - r += a * 2; - } while(++y < maxy); - - sdraw->src = p; - sdraw->src2 = q; - sdraw->dst = r; - sdraw->y = y; -} -#endif - -static const SDRAWFN SDSYM(n)[] = { - SDSYM(n_0), SDSYM(n_t), SDSYM(n_g), SDSYM(n_2), - SDSYM(n_0), SDSYM(n_ti), SDSYM(n_gi), SDSYM(n_2i), - SDSYM(n_0), SDSYM(n_ti), SDSYM(n_gie), SDSYM(n_2ie), -#if defined(SUPPORT_CRT15KHZ) - SDSYM(n_0), SDSYM(n_td), SDSYM(n_gd), SDSYM(n_2d), -#endif - }; -#endif - + +// ---- plasma display + +// vram off +static void SCRNCALL SDSYM(p_0)(SDRAW sdraw, int maxy) { + + UINT8 *p; + int y; + int x; + + p = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x++) { + SDSETPIXEL(p, NP2PAL_TEXT2); + p += sdraw->xalign; + } + p -= sdraw->xbytes; + } + p += sdraw->yalign; + } while(++y < maxy); + + sdraw->dst = p; + sdraw->y = y; +} + +// text or grph 1プレーン +static void SCRNCALL SDSYM(p_1)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int y; + int x; + + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || !bVFImport) { + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, q, x, y, sdraw->xalign); + } +#else + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); +#endif + q += sdraw->xalign; + } + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + } while(++y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// text + grph +static void SCRNCALL SDSYM(p_2)(SDRAW sdraw, int maxy) { + +const UINT8 *p; +const UINT8 *q; + UINT8 *r; + int y; + int x; + + p = sdraw->src; + q = sdraw->src2; + r = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || q[x]) { + SDSETPIXEL(r, p[x] + q[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, r, x, y, sdraw->xalign); + } +#else + SDSETPIXEL(r, p[x] + q[x] + NP2PAL_GRPH); +#endif + r += sdraw->xalign; + } + r -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += SURFACE_WIDTH; + r += sdraw->yalign; + } while(++y < maxy); + + sdraw->src = p; + sdraw->src2 = q; + sdraw->dst = r; + sdraw->y = y; +} + +// text + (grph:interleave) +static void SCRNCALL SDSYM(p_ti)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int y; + int x; + + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || !bVFImport) { + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, q, x, y, sdraw->xalign); + } +#else + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); +#endif + q += sdraw->xalign; + } + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + + if (sdraw->dirty[y+1]) { + for (x=0; xwidth; x++) { + SDSETPIXEL(q, (p[x] >> 4) + NP2PAL_TEXT); + q += sdraw->xalign; + } + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// grph:interleave +static void SCRNCALL SDSYM(p_gi)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int y; + int x; + + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, q, x, y, sdraw->xalign); + } +#else + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); +#endif + q += sdraw->xalign; + } + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + + if (sdraw->dirty[y+1]) { + for (x=0; xwidth; x++) { + SDSETPIXEL(q, NP2PAL_TEXT); + q += sdraw->xalign; + } + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// text + grph:interleave +static void SCRNCALL SDSYM(p_2i)(SDRAW sdraw, int maxy) { + +const UINT8 *p; +const UINT8 *q; + UINT8 *r; + int y; + int x; + + p = sdraw->src; + q = sdraw->src2; + r = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || q[x]) { + SDSETPIXEL(r, p[x] + q[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, r, x, y, sdraw->xalign); + } +#else + SDSETPIXEL(r, p[x] + q[x] + NP2PAL_GRPH); +#endif + r += sdraw->xalign; + } + r -= sdraw->xbytes; + } + q += SURFACE_WIDTH; + r += sdraw->yalign; + + if (sdraw->dirty[y+1]) { + for (x=0; xwidth; x++) { + SDSETPIXEL(r, (q[x] >> 4) + NP2PAL_TEXT); + r += sdraw->xalign; + } + r -= sdraw->xbytes; + } + p += (SURFACE_WIDTH * 2); + q += SURFACE_WIDTH; + r += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->src2 = q; + sdraw->dst = r; + sdraw->y = y; +} + +// grph:interleave ex +static void SCRNCALL SDSYM(p_gie)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int y; + int x; + + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + sdraw->dirty[y+1] |= 0xff; + for (x=0; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || !bVFImport) { + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, q, x, y, sdraw->xalign); + } +#else + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); +#endif + q += sdraw->xalign; + } + q -= sdraw->xbytes; + } + q += sdraw->yalign; + + if (sdraw->dirty[y+1]) { + for (x=0; xwidth; x++) { + SDSETPIXEL(q, p[x] + NP2PAL_SKIP); + q += sdraw->xalign; + } + q -= sdraw->xbytes; + } + p += (SURFACE_WIDTH * 2); + q += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// text + grph:interleave ex +static void SCRNCALL SDSYM(p_2ie)(SDRAW sdraw, int maxy) { + +const UINT8 *p; +const UINT8 *q; + UINT8 *r; + int y; + int x; + UINT8 c; + + p = sdraw->src; + q = sdraw->src2; + r = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + sdraw->dirty[y+1] |= 0xff; + for (x=0; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || q[x]) { + SDSETPIXEL(r, p[x] + q[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, r, x, y, sdraw->xalign); + } +#else + SDSETPIXEL(r, p[x] + q[x] + NP2PAL_GRPH); +#endif + r += sdraw->xalign; + } + r -= sdraw->xbytes; + } + q += SURFACE_WIDTH; + r += sdraw->yalign; + + if (sdraw->dirty[y+1]) { + for (x=0; xwidth; x++) { + c = q[x] >> 4; + if (!c) { + c = p[x] + NP2PALS_TXT; + } + SDSETPIXEL(r, c + NP2PAL_TEXT); + r += sdraw->xalign; + } + r -= sdraw->xbytes; + } + p += (SURFACE_WIDTH * 2); + q += SURFACE_WIDTH; + r += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->src2 = q; + sdraw->dst = r; + sdraw->y = y; +} + +#if defined(SUPPORT_CRT15KHZ) +// text or grph 1プレーン(15kHz) +static void SCRNCALL SDSYM(p_1d)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int a; + int y; + int x; + int c; + + p = sdraw->src; + q = sdraw->dst; + a = sdraw->yalign; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || !bVFImport) { + c = p[x] + NP2PAL_GRPH; + SDSETPIXEL(q, c); + SDSETPIXEL((q + a), c); + } else { + VideoFilter_PutDest(hVFMng1, q, x, y, sdraw->xalign); + VideoFilter_PutDest(hVFMng1, q + a, x, y, sdraw->xalign); + } +#else + c = p[x] + NP2PAL_GRPH; + SDSETPIXEL(q, c); + SDSETPIXEL((q + a), c); +#endif + q += sdraw->xalign; + } + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += a * 2; + } while(++y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// text + grph (15kHz) +static void SCRNCALL SDSYM(p_2d)(SDRAW sdraw, int maxy) { + +const UINT8 *p; +const UINT8 *q; + UINT8 *r; + int a; + int y; + int x; + int c; + + p = sdraw->src; + q = sdraw->src2; + r = sdraw->dst; + a = sdraw->yalign; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || q[x]) { + c = p[x] + q[x] + NP2PAL_GRPH; + SDSETPIXEL(r, c); + SDSETPIXEL((r + a), c); + } else { + VideoFilter_PutDest(hVFMng1, r, x, y, sdraw->xalign); + VideoFilter_PutDest(hVFMng1, r + a, x, y, sdraw->xalign); + } +#else + c = p[x] + q[x] + NP2PAL_GRPH; + SDSETPIXEL(r, c); + SDSETPIXEL((r + a), c); +#endif + r += sdraw->xalign; + } + r -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += SURFACE_WIDTH; + r += a * 2; + } while(++y < maxy); + + sdraw->src = p; + sdraw->src2 = q; + sdraw->dst = r; + sdraw->y = y; +} +#endif + +static const SDRAWFN SDSYM(p)[] = { + SDSYM(p_0), SDSYM(p_1), SDSYM(p_1), SDSYM(p_2), + SDSYM(p_0), SDSYM(p_ti), SDSYM(p_gi), SDSYM(p_2i), + SDSYM(p_0), SDSYM(p_ti), SDSYM(p_gie), SDSYM(p_2ie), +#if defined(SUPPORT_CRT15KHZ) + SDSYM(p_0), SDSYM(p_1d), SDSYM(p_1d), SDSYM(p_2d), +#endif + }; + +// ---- normal display + +#ifdef SUPPORT_NORMALDISP + +// vram off +static void SCRNCALL SDSYM(n_0)(SDRAW sdraw, int maxy) { + + UINT8 *p; + int y; + int x; + + p = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + SDSETPIXEL(p, NP2PAL_TEXT3); + for (x=0; xwidth; x++) { + p += sdraw->xalign; + SDSETPIXEL(p, NP2PAL_TEXT2); + } + p -= sdraw->xbytes; + } + p += sdraw->yalign; + } while(++y < maxy); + + sdraw->dst = p; + sdraw->y = y; +} + +// text 1プレーン +static void SCRNCALL SDSYM(n_t)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int y; + int x; + + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + SDSETPIXEL(q, (p[0] >> 4) + NP2PAL_TEXT3); + q += sdraw->xalign; + for (x=1; xwidth; x++) { + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); + q += sdraw->xalign; + } + SDSETPIXEL(q, NP2PAL_TEXT2); + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + } while(++y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// grph 1プレーン +static void SCRNCALL SDSYM(n_g)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int y; + int x; + + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + SDSETPIXEL(q, NP2PAL_TEXT3); + for (x=0; xwidth; x++) { + q += sdraw->xalign; +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, q, x, y, sdraw->xalign); + } +#else + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); +#endif + } + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + } while(++y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// text + grph +static void SCRNCALL SDSYM(n_2)(SDRAW sdraw, int maxy) { + +const UINT8 *p; +const UINT8 *q; + UINT8 *r; + int y; + int x; + + p = sdraw->src; + q = sdraw->src2; + r = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + SDSETPIXEL(r, (q[0] >> 4) + NP2PAL_TEXT3); + r += sdraw->xalign; + for (x=1; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || q[x]) { + SDSETPIXEL(r, p[x-1] + q[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, r, x - 1, y, sdraw->xalign); + } +#else + SDSETPIXEL(r, p[x-1] + q[x] + NP2PAL_GRPH); +#endif + r += sdraw->xalign; + } +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + SDSETPIXEL(r, p[x-1] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, r, x - 1, y, sdraw->xalign); + } +#else + SDSETPIXEL(r, p[x-1] + NP2PAL_GRPH); +#endif + r -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += SURFACE_WIDTH; + r += sdraw->yalign; + } while(++y < maxy); + + sdraw->src = p; + sdraw->src2 = q; + sdraw->dst = r; + sdraw->y = y; +} + +// text + (grph:interleave) +static void SCRNCALL SDSYM(n_ti)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int y; + int x; + + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + SDSETPIXEL(q, (p[0] >> 4) + NP2PAL_TEXT3); + q += sdraw->xalign; + for (x=1; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || !bVFImport) { + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, q, x, y, sdraw->xalign); + } +#else + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); +#endif + q += sdraw->xalign; + } + SDSETPIXEL(q, NP2PAL_GRPH); + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + + if (sdraw->dirty[y+1]) { + SDSETPIXEL(q, (p[0] >> 4) + NP2PAL_TEXT3); + q += sdraw->xalign; + for (x=1; xwidth; x++) { + SDSETPIXEL(q, (p[x] >> 4) + NP2PAL_TEXT); + q += sdraw->xalign; + } + SDSETPIXEL(q, NP2PAL_TEXT); + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// grph:interleave +static void SCRNCALL SDSYM(n_gi)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int y; + int x; + + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + SDSETPIXEL(q, NP2PAL_TEXT3); + for (x=0; xwidth; x++) { + q += sdraw->xalign; +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, q, x, y, sdraw->xalign); + } +#else + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); +#endif + } + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + + if (sdraw->dirty[y+1]) { + SDSETPIXEL(q, NP2PAL_TEXT3); + for (x=0; xwidth; x++) { + q += sdraw->xalign; + SDSETPIXEL(q, NP2PAL_TEXT); + } + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// text + grph:interleave +static void SCRNCALL SDSYM(n_2i)(SDRAW sdraw, int maxy) { + +const UINT8 *p; +const UINT8 *q; + UINT8 *r; + int y; + int x; + + p = sdraw->src; + q = sdraw->src2; + r = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + SDSETPIXEL(r, (q[0] >> 4) + NP2PAL_TEXT3); + r += sdraw->xalign; + for (x=1; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || q[x]) { + SDSETPIXEL(r, p[x-1] + q[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, r, x - 1, y, sdraw->xalign); + } +#else + SDSETPIXEL(r, p[x-1] + q[x] + NP2PAL_GRPH); +#endif + r += sdraw->xalign; + } +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + SDSETPIXEL(r, p[x-1] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, r, x - 1, y, sdraw->xalign); + } +#else + SDSETPIXEL(r, p[x-1] + NP2PAL_GRPH); +#endif + r -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += SURFACE_WIDTH; + r += sdraw->yalign; + + if (sdraw->dirty[y+1]) { + SDSETPIXEL(r, (q[0] >> 4) + NP2PAL_TEXT3); + r += sdraw->xalign; + for (x=1; xwidth; x++) { + SDSETPIXEL(r, (q[x] >> 4) + NP2PAL_TEXT); + r += sdraw->xalign; + } + SDSETPIXEL(r, NP2PAL_TEXT); + r -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += SURFACE_WIDTH; + r += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->src2 = q; + sdraw->dst = r; + sdraw->y = y; +} + +// grph:interleave ex +static void SCRNCALL SDSYM(n_gie)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int y; + int x; + + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + sdraw->dirty[y+1] |= 0xff; + SDSETPIXEL(q, NP2PAL_TEXT3); + for (x=0; xwidth; x++) { + q += sdraw->xalign; +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, q, x, y, sdraw->xalign); + } +#else + SDSETPIXEL(q, p[x] + NP2PAL_GRPH); +#endif + } + q -= sdraw->xbytes; + } + q += sdraw->yalign; + + if (sdraw->dirty[y+1]) { + SDSETPIXEL(q, NP2PAL_TEXT3); + for (x=0; xwidth; x++) { + q += sdraw->xalign; + SDSETPIXEL(q, p[x] + NP2PAL_SKIP); + } + q -= sdraw->xbytes; + } + p += (SURFACE_WIDTH * 2); + q += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// text + grph:interleave ex +static void SCRNCALL SDSYM(n_2ie)(SDRAW sdraw, int maxy) { + +const UINT8 *p; +const UINT8 *q; + UINT8 *r; + int y; + int x; + UINT8 c; + + p = sdraw->src; + q = sdraw->src2; + r = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + sdraw->dirty[y+1] |= 0xff; + SDSETPIXEL(r, (q[0] >> 4) + NP2PAL_TEXT3); + r += sdraw->xalign; + for (x=1; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || q[x]) { + SDSETPIXEL(r, p[x-1] + q[x] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, r, x - 1, y, sdraw->xalign); + } +#else + SDSETPIXEL(r, p[x-1] + q[x] + NP2PAL_GRPH); +#endif + r += sdraw->xalign; + } +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + SDSETPIXEL(r, p[x-1] + NP2PAL_GRPH); + } else { + VideoFilter_PutDest(hVFMng1, r, x - 1, y, sdraw->xalign); + } +#else + SDSETPIXEL(r, p[x-1] + NP2PAL_GRPH); +#endif + r -= sdraw->xbytes; + } + q += SURFACE_WIDTH; + r += sdraw->yalign; + + if (sdraw->dirty[y+1]) { + SDSETPIXEL(r, (q[0] >> 4) + NP2PAL_TEXT3); + r += sdraw->xalign; + for (x=1; xwidth; x++) { + c = q[x] >> 4; + if (!c) { + c = p[x-1] + NP2PALS_TXT; + } + SDSETPIXEL(r, c + NP2PAL_TEXT); + r += sdraw->xalign; + } + SDSETPIXEL(r, p[x-1] + NP2PAL_SKIP); + r -= sdraw->xbytes; + } + p += (SURFACE_WIDTH * 2); + q += SURFACE_WIDTH; + r += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->src2 = q; + sdraw->dst = r; + sdraw->y = y; +} + +#if defined(SUPPORT_CRT15KHZ) +// text 1プレーン (15kHz) +static void SCRNCALL SDSYM(n_td)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int a; + int y; + int x; + int c; + + p = sdraw->src; + q = sdraw->dst; + a = sdraw->yalign; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + c = (p[0] >> 4) + NP2PAL_TEXT3; + SDSETPIXEL(q, c); + SDSETPIXEL((q + a), c); + q += sdraw->xalign; + for (x=1; xwidth; x++) { + c = p[x] + NP2PAL_GRPH; + SDSETPIXEL(q, c); + SDSETPIXEL((q + a), c); + q += sdraw->xalign; + } + SDSETPIXEL(q, NP2PAL_TEXT2); + SDSETPIXEL((q + a), NP2PAL_TEXT2); + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += a * 2; + } while(++y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// grph 1プレーン (15kHz) +static void SCRNCALL SDSYM(n_gd)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int a; + int y; + int x; + int c; + + p = sdraw->src; + q = sdraw->dst; + a = sdraw->yalign; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + SDSETPIXEL(q, NP2PAL_TEXT3); + SDSETPIXEL((q + a), NP2PAL_TEXT3); + for (x=0; xwidth; x++) { + q += sdraw->xalign; +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + c = p[x] + NP2PAL_GRPH; + SDSETPIXEL(q, c); + SDSETPIXEL((q + a), c); + } else { + VideoFilter_PutDest(hVFMng1, q, x, y, sdraw->xalign); + VideoFilter_PutDest(hVFMng1, q, x, y + 1, sdraw->xalign); + } +#else + c = p[x] + NP2PAL_GRPH; + SDSETPIXEL(q, c); + SDSETPIXEL((q + a), c); +#endif + } + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += a * 2; + } while(++y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// text + grph (15kHz) +static void SCRNCALL SDSYM(n_2d)(SDRAW sdraw, int maxy) { + +const UINT8 *p; +const UINT8 *q; + UINT8 *r; + int a; + int y; + int x; + int c; + + p = sdraw->src; + q = sdraw->src2; + r = sdraw->dst; + a = sdraw->yalign; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + c = (q[0] >> 4) + NP2PAL_TEXT3; + SDSETPIXEL(r, c); + SDSETPIXEL((r + a), c); + r += sdraw->xalign; + for (x=1; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable || q[x]) { + c = p[x-1] + q[x] + NP2PAL_GRPH; + SDSETPIXEL(r, c); + SDSETPIXEL((r + a), c); + } else { + VideoFilter_PutDest(hVFMng1, r, x - 1, y, sdraw->xalign); + VideoFilter_PutDest(hVFMng1, r, x - 1, y + 1, sdraw->xalign); + } +#else + c = p[x-1] + q[x] + NP2PAL_GRPH; + SDSETPIXEL(r, c); + SDSETPIXEL((r + a), c); +#endif + r += sdraw->xalign; + } +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + c = p[x-1] + NP2PAL_GRPH; + SDSETPIXEL(r, c); + SDSETPIXEL((r + a), c); + } else { + VideoFilter_PutDest(hVFMng1, r, x - 1, y, sdraw->xalign); + VideoFilter_PutDest(hVFMng1, r, x - 1, y + 1, sdraw->xalign); + } +#else + c = p[x-1] + NP2PAL_GRPH; + SDSETPIXEL(r, c); + SDSETPIXEL((r + a), c); +#endif + r -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += SURFACE_WIDTH; + r += a * 2; + } while(++y < maxy); + + sdraw->src = p; + sdraw->src2 = q; + sdraw->dst = r; + sdraw->y = y; +} +#endif + +static const SDRAWFN SDSYM(n)[] = { + SDSYM(n_0), SDSYM(n_t), SDSYM(n_g), SDSYM(n_2), + SDSYM(n_0), SDSYM(n_ti), SDSYM(n_gi), SDSYM(n_2i), + SDSYM(n_0), SDSYM(n_ti), SDSYM(n_gie), SDSYM(n_2ie), +#if defined(SUPPORT_CRT15KHZ) + SDSYM(n_0), SDSYM(n_td), SDSYM(n_gd), SDSYM(n_2d), +#endif + }; +#endif + diff --git a/vram/sdrawex.mcr b/vram/sdrawex.mcr old mode 100644 new mode 100755 index f5d26122..a072fb6d --- a/vram/sdrawex.mcr +++ b/vram/sdrawex.mcr @@ -1,270 +1,302 @@ - -#if defined(SUPPORT_PC9821) - -// ---- plasma display - -// vram off -static void SCRNCALL SDSYM(pex_0)(SDRAW sdraw, int maxy) { - - UINT8 *p; - int y; - int x; - - p = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x++) { - SDSETPIXEL(p, NP2PAL_TEXTEX); - p += sdraw->xalign; - } - p -= sdraw->xbytes; - } - p += sdraw->yalign; - } while(++y < maxy); - - sdraw->dst = p; - sdraw->y = y; -} - -// text 1ƒvƒŒ[ƒ“ -static void SCRNCALL SDSYM(pex_t)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int y; - int x; - - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x++) { - SDSETPIXEL(q, (p[x] >> 4) + NP2PAL_TEXTEX); - q += sdraw->xalign; - } - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - } while(++y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// grph 1ƒvƒŒ[ƒ“ -static void SCRNCALL SDSYM(pex_g)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int y; - int x; - - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x++) { - SDSETPIXEL(q, p[x] + NP2PAL_GRPHEX); - q += sdraw->xalign; - } - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - } while(++y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// text + grph -static void SCRNCALL SDSYM(pex_2)(SDRAW sdraw, int maxy) { - -const UINT8 *p; -const UINT8 *q; - UINT8 *r; - int y; - int x; - int c; - - p = sdraw->src; - q = sdraw->src2; - r = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x++) { - c = q[x]; - if (c != 0) { - c = (c >> 4) + NP2PAL_TEXTEX; - } - else { - c = p[x] + NP2PAL_GRPHEX; - } - SDSETPIXEL(r, c); - r += sdraw->xalign; - } - r -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += SURFACE_WIDTH; - r += sdraw->yalign; - } while(++y < maxy); - - sdraw->src = p; - sdraw->src2 = q; - sdraw->dst = r; - sdraw->y = y; -} - - -static const SDRAWFN SDSYM(pex)[] = { - SDSYM(pex_0), SDSYM(pex_t), SDSYM(pex_g), SDSYM(pex_2), - }; - - -// ---- normal display - -#ifdef SUPPORT_NORMALDISP - -// vram off -static void SCRNCALL SDSYM(nex_0)(SDRAW sdraw, int maxy) { - - UINT8 *p; - int y; - int x; - - p = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - SDSETPIXEL(p, NP2PAL_TEXTEX3); - for (x=0; xwidth; x++) { - p += sdraw->xalign; - SDSETPIXEL(p, NP2PAL_TEXTEX); - } - p -= sdraw->xbytes; - } - p += sdraw->yalign; - } while(++y < maxy); - - sdraw->dst = p; - sdraw->y = y; -} - -// text 1ƒvƒŒ[ƒ“ -static void SCRNCALL SDSYM(nex_t)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int y; - int x; - - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - SDSETPIXEL(q, (p[0] >> 4) + NP2PAL_TEXTEX3); - q += sdraw->xalign; - for (x=1; xwidth; x++) { - SDSETPIXEL(q, (p[x] >> 4) + NP2PAL_TEXTEX); - q += sdraw->xalign; - } - SDSETPIXEL(q, NP2PAL_TEXTEX); - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - } while(++y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// grph 1ƒvƒŒ[ƒ“ -static void SCRNCALL SDSYM(nex_g)(SDRAW sdraw, int maxy) { - -const UINT8 *p; - UINT8 *q; - int y; - int x; - - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - SDSETPIXEL(q, NP2PAL_TEXTEX3); - for (x=0; xwidth; x++) { - q += sdraw->xalign; - SDSETPIXEL(q, p[x] + NP2PAL_GRPHEX); - } - q -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - } while(++y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// text + grph -static void SCRNCALL SDSYM(nex_2)(SDRAW sdraw, int maxy) { - -const UINT8 *p; -const UINT8 *q; - UINT8 *r; - int y; - int x; - int c; - - p = sdraw->src; - q = sdraw->src2; - r = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - SDSETPIXEL(r, (q[0] >> 4) + NP2PAL_TEXT3); - r += sdraw->xalign; - for (x=1; xwidth; x++) { - c = q[x]; - if (c) { - c = (c >> 4) + NP2PAL_TEXTEX; - } - else { - c = p[x-1] + NP2PAL_GRPHEX; - } - SDSETPIXEL(r, c); - r += sdraw->xalign; - } - SDSETPIXEL(r, p[x-1] + NP2PAL_GRPHEX); - r -= sdraw->xbytes; - } - p += SURFACE_WIDTH; - q += SURFACE_WIDTH; - r += sdraw->yalign; - } while(++y < maxy); - - sdraw->src = p; - sdraw->src2 = q; - sdraw->dst = r; - sdraw->y = y; -} - -static const SDRAWFN SDSYM(nex)[] = { - SDSYM(nex_0), SDSYM(nex_t), SDSYM(nex_g), SDSYM(nex_2) - }; -#endif - -#endif - + +#if defined(SUPPORT_PC9821) + +// ---- plasma display + +// vram off +static void SCRNCALL SDSYM(pex_0)(SDRAW sdraw, int maxy) { + + UINT8 *p; + int y; + int x; + + p = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x++) { + SDSETPIXEL(p, NP2PAL_TEXTEX); + p += sdraw->xalign; + } + p -= sdraw->xbytes; + } + p += sdraw->yalign; + } while(++y < maxy); + + sdraw->dst = p; + sdraw->y = y; +} + +// text 1プレーン +static void SCRNCALL SDSYM(pex_t)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int y; + int x; + + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x++) { + SDSETPIXEL(q, (p[x] >> 4) + NP2PAL_TEXTEX); + q += sdraw->xalign; + } + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + } while(++y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// grph 1プレーン +static void SCRNCALL SDSYM(pex_g)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int y; + int x; + + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x++) { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + SDSETPIXEL(q, p[x] + NP2PAL_GRPHEX); + } else { + VideoFilter_PutDest(hVFMng1, q, x, y, sdraw->xalign); + } +#else + SDSETPIXEL(q, p[x] + NP2PAL_GRPHEX); +#endif + q += sdraw->xalign; + } + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + } while(++y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// text + grph +static void SCRNCALL SDSYM(pex_2)(SDRAW sdraw, int maxy) { + +const UINT8 *p; +const UINT8 *q; + UINT8 *r; + int y; + int x; + int c; + + p = sdraw->src; + q = sdraw->src2; + r = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x++) { + c = q[x]; + if (c != 0) { + c = (c >> 4) + NP2PAL_TEXTEX; + } + else { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + c = p[x] + NP2PAL_GRPHEX; + } else { + VideoFilter_PutDest(hVFMng1, &c, x, y, sdraw->xalign); + } +#else + c = p[x] + NP2PAL_GRPHEX; +#endif + } + SDSETPIXEL(r, c); + r += sdraw->xalign; + } + r -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += SURFACE_WIDTH; + r += sdraw->yalign; + } while(++y < maxy); + + sdraw->src = p; + sdraw->src2 = q; + sdraw->dst = r; + sdraw->y = y; +} + + +static const SDRAWFN SDSYM(pex)[] = { + SDSYM(pex_0), SDSYM(pex_t), SDSYM(pex_g), SDSYM(pex_2), + }; + + +// ---- normal display + +#ifdef SUPPORT_NORMALDISP + +// vram off +static void SCRNCALL SDSYM(nex_0)(SDRAW sdraw, int maxy) { + + UINT8 *p; + int y; + int x; + + p = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + SDSETPIXEL(p, NP2PAL_TEXTEX3); + for (x=0; xwidth; x++) { + p += sdraw->xalign; + SDSETPIXEL(p, NP2PAL_TEXTEX); + } + p -= sdraw->xbytes; + } + p += sdraw->yalign; + } while(++y < maxy); + + sdraw->dst = p; + sdraw->y = y; +} + +// text 1プレーン +static void SCRNCALL SDSYM(nex_t)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int y; + int x; + + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + SDSETPIXEL(q, (p[0] >> 4) + NP2PAL_TEXTEX3); + q += sdraw->xalign; + for (x=1; xwidth; x++) { + SDSETPIXEL(q, (p[x] >> 4) + NP2PAL_TEXTEX); + q += sdraw->xalign; + } + SDSETPIXEL(q, NP2PAL_TEXTEX); + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + } while(++y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// grph 1プレーン +static void SCRNCALL SDSYM(nex_g)(SDRAW sdraw, int maxy) { + +const UINT8 *p; + UINT8 *q; + int y; + int x; + + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + SDSETPIXEL(q, NP2PAL_TEXTEX3); + for (x=0; xwidth; x++) { + q += sdraw->xalign; +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + SDSETPIXEL(q, p[x] + NP2PAL_GRPHEX); + } else { + VideoFilter_PutDest(hVFMng1, q, x, y, sdraw->xalign); + } +#else + SDSETPIXEL(q, p[x] + NP2PAL_GRPHEX); +#endif + } + q -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + } while(++y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// text + grph +static void SCRNCALL SDSYM(nex_2)(SDRAW sdraw, int maxy) { + +const UINT8 *p; +const UINT8 *q; + UINT8 *r; + int y; + int x; + int c; + + p = sdraw->src; + q = sdraw->src2; + r = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + SDSETPIXEL(r, (q[0] >> 4) + NP2PAL_TEXT3); + r += sdraw->xalign; + for (x=1; xwidth; x++) { + c = q[x]; + if (c) { + c = (c >> 4) + NP2PAL_TEXTEX; + } + else { +#if defined(SUPPORT_VIDEOFILTER) + if(!bVFEnable) { + c = p[x-1] + NP2PAL_GRPHEX; + } else { + VideoFilter_PutDest(hVFMng1, &c, x - 1, y, sdraw->xalign); + } +#else + c = p[x-1] + NP2PAL_GRPHEX; +#endif + } + SDSETPIXEL(r, c); + r += sdraw->xalign; + } + SDSETPIXEL(r, p[x-1] + NP2PAL_GRPHEX); + r -= sdraw->xbytes; + } + p += SURFACE_WIDTH; + q += SURFACE_WIDTH; + r += sdraw->yalign; + } while(++y < maxy); + + sdraw->src = p; + sdraw->src2 = q; + sdraw->dst = r; + sdraw->y = y; +} + +static const SDRAWFN SDSYM(nex)[] = { + SDSYM(nex_0), SDSYM(nex_t), SDSYM(nex_g), SDSYM(nex_2) + }; +#endif + +#endif + diff --git a/vram/sdrawq16.c b/vram/sdrawq16.c old mode 100644 new mode 100755 index f61843a6..e7411174 --- a/vram/sdrawq16.c +++ b/vram/sdrawq16.c @@ -1,306 +1,306 @@ -#include "compiler.h" -#include "scrnmng.h" -#include "scrndraw.h" -#include "sdraw.h" -#include "palettes.h" - - -#if defined(SIZE_QVGA) && !defined(SIZE_VGATEST) && defined(SUPPORT_16BPP) - -// vram off -static void SCRNCALL qvga16p_0(SDRAW sdraw, int maxy) { - - int xbytes; - UINT32 palwork; - UINT16 pal; - UINT8 *p; - int y; - int x; - - xbytes = sdraw->xalign * sdraw->width / 2; - palwork = np2_pal16[NP2PAL_TEXT2]; - pal = (UINT16)(palwork + (palwork >> 16)); - p = sdraw->dst; - y = sdraw->y; - do { - if (*(UINT16 *)(sdraw->dirty + y)) { - for (x=0; xwidth; x+=2) { - *(UINT16 *)p = pal; - p += sdraw->xalign; - } - p -= xbytes; - } - p += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->dst = p; - sdraw->y = y; -} - -// text or grph 1ƒvƒŒ[ƒ“ -static void SCRNCALL qvga16p_1(SDRAW sdraw, int maxy) { - - int xbytes; -const UINT8 *p; - UINT8 *q; - int y; - int x; - UINT32 work; - - xbytes = sdraw->xalign * sdraw->width / 2; - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (*(UINT16 *)(sdraw->dirty + y)) { - for (x=0; xwidth; x+=2) { - work = np2_pal16[p[x+0] + NP2PAL_GRPH]; - work += np2_pal16[p[x+1] + NP2PAL_GRPH]; - work += np2_pal16[p[x+0+SURFACE_WIDTH] + NP2PAL_GRPH]; - work += np2_pal16[p[x+1+SURFACE_WIDTH] + NP2PAL_GRPH]; - work &= 0x07e0f81f << 2; - *(UINT16 *)q = (UINT16)((work >> 2) + (work >> 18)); - q += sdraw->xalign; - } - q -= xbytes; - } - p += SURFACE_WIDTH * 2; - q += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// text + grph -static void SCRNCALL qvga16p_2(SDRAW sdraw, int maxy) { - - int xbytes; -const UINT8 *p; -const UINT8 *q; - UINT8 *r; - int y; - int x; - UINT32 work; - - xbytes = sdraw->xalign * sdraw->width / 2; - p = sdraw->src; - q = sdraw->src2; - r = sdraw->dst; - y = sdraw->y; - do { - if (*(UINT16 *)(sdraw->dirty + y)) { - for (x=0; xwidth; x+=2) { - work = np2_pal16[p[x+0] + q[x+0] + NP2PAL_GRPH]; - work += np2_pal16[p[x+1] + q[x+1] + NP2PAL_GRPH]; - work += np2_pal16[p[x+0+SURFACE_WIDTH] + - q[x+0+SURFACE_WIDTH] + NP2PAL_GRPH]; - work += np2_pal16[p[x+1+SURFACE_WIDTH] + - q[x+1+SURFACE_WIDTH] + NP2PAL_GRPH]; - work &= 0x07e0f81f << 2; - *(UINT16 *)r = (UINT16)((work >> 2) + (work >> 18)); - r += sdraw->xalign; - } - r -= xbytes; - } - p += SURFACE_WIDTH * 2; - q += SURFACE_WIDTH * 2; - r += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->src2 = q; - sdraw->dst = r; - sdraw->y = y; -} - -// text + (grph:interleave) - > qvga16p_1 - -// grph:interleave -static void SCRNCALL qvga16p_gi(SDRAW sdraw, int maxy) { - - int xbytes; -const UINT8 *p; - UINT8 *q; - int y; - int x; - UINT32 work; - - xbytes = sdraw->xalign * sdraw->width / 2; - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (*(UINT16 *)(sdraw->dirty + y)) { - for (x=0; xwidth; x+=2) { - work = np2_pal16[p[x+0] + NP2PAL_GRPH]; - work += np2_pal16[p[x+1] + NP2PAL_GRPH]; - work &= 0x07e0f81f << 1; - *(UINT16 *)q = (UINT16)((work >> 1) + (work >> 17)); - q += sdraw->xalign; - } - q -= xbytes; - } - p += SURFACE_WIDTH * 2; - q += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// text + grph:interleave -static void SCRNCALL qvga16p_2i(SDRAW sdraw, int maxy) { - - int xbytes; -const UINT8 *p; -const UINT8 *q; - UINT8 *r; - int y; - int x; - UINT32 work; - - xbytes = sdraw->xalign * sdraw->width / 2; - p = sdraw->src; - q = sdraw->src2; - r = sdraw->dst; - y = sdraw->y; - do { - if (*(UINT16 *)(sdraw->dirty + y)) { - for (x=0; xwidth; x+=2) { - work = np2_pal16[p[x+0] + q[x+0] + NP2PAL_GRPH]; - work += np2_pal16[p[x+1] + q[x+1] + NP2PAL_GRPH]; - if (q[x+0+SURFACE_WIDTH] & 0xf0) { - work += np2_pal16[(q[x+0+SURFACE_WIDTH] >> 4) - + NP2PAL_TEXT]; - } - else { - work += np2_pal16[p[x+0] + NP2PAL_GRPH]; - } - if (q[x+1+SURFACE_WIDTH] & 0xf0) { - work += np2_pal16[(q[x+1+SURFACE_WIDTH] >> 4) - + NP2PAL_TEXT]; - } - else { - work += np2_pal16[p[x+1] + NP2PAL_GRPH]; - } - work &= 0x07e0f81f << 2; - *(UINT16 *)r = (UINT16)((work >> 2) + (work >> 18)); - r += sdraw->xalign; - } - r -= xbytes; - } - p += SURFACE_WIDTH * 2; - q += SURFACE_WIDTH * 2; - r += sdraw->yalign; - y += 2; - } while(y < maxy); - - sdraw->src = p; - sdraw->src2 = q; - sdraw->dst = r; - sdraw->y = y; -} - -#if defined(SUPPORT_CRT15KHZ) -// text or grph 1ƒvƒŒ[ƒ“ (15kHz) -static void SCRNCALL qvga16p_1d(SDRAW sdraw, int maxy) { - - int xbytes; -const UINT8 *p; - UINT8 *q; - int y; - int x; - UINT32 work; - - xbytes = sdraw->xalign * sdraw->width / 2; - p = sdraw->src; - q = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x+=2) { - work = np2_pal16[p[x+0] + NP2PAL_GRPH]; - work += np2_pal16[p[x+1] + NP2PAL_GRPH]; - work &= 0x07e0f81f << 1; - *(UINT16 *)q = (UINT16)((work >> 1) + (work >> 17)); - q += sdraw->xalign; - } - q -= xbytes; - } - p += SURFACE_WIDTH; - q += sdraw->yalign; - } while(++y < maxy); - - sdraw->src = p; - sdraw->dst = q; - sdraw->y = y; -} - -// text + grph (15kHz) -static void SCRNCALL qvga16p_2d(SDRAW sdraw, int maxy) { - - int xbytes; -const UINT8 *p; -const UINT8 *q; - UINT8 *r; - int y; - int x; - UINT32 work; - - xbytes = sdraw->xalign * sdraw->width / 2; - p = sdraw->src; - q = sdraw->src2; - r = sdraw->dst; - y = sdraw->y; - do { - if (sdraw->dirty[y]) { - for (x=0; xwidth; x+=2) { - work = np2_pal16[p[x+0] + q[x+0] + NP2PAL_GRPH]; - work += np2_pal16[p[x+1] + q[x+1] + NP2PAL_GRPH]; - work &= 0x07e0f81f << 1; - *(UINT16 *)r = (UINT16)((work >> 1) + (work >> 17)); - r += sdraw->xalign; - } - r -= xbytes; - } - p += SURFACE_WIDTH; - q += SURFACE_WIDTH; - r += sdraw->yalign; - } while(++y < maxy); - - sdraw->src = p; - sdraw->src2 = q; - sdraw->dst = r; - sdraw->y = y; -} -#endif - - -static const SDRAWFN qvga16p[] = { - qvga16p_0, qvga16p_1, qvga16p_1, qvga16p_2, - qvga16p_0, qvga16p_1, qvga16p_gi, qvga16p_2i, - qvga16p_0, qvga16p_1, qvga16p_gi, qvga16p_2i, -#if defined(SUPPORT_CRT15KHZ) - qvga16p_0, qvga16p_1d, qvga16p_1d, qvga16p_2d, -#endif - }; - -const SDRAWFN *sdraw_getproctbl(const SCRNSURF *surf) { - - if (surf->bpp == 16) { - return(qvga16p); - } - else { - return(NULL); - } -} - -#endif - +#include +#include +#include +#include "sdraw.h" +#include + + +#if defined(NP2_SIZE_QVGA) && !defined(SIZE_VGATEST) && defined(SUPPORT_16BPP) + +// vram off +static void SCRNCALL qvga16p_0(SDRAW sdraw, int maxy) { + + int xbytes; + UINT32 palwork; + UINT16 pal; + UINT8 *p; + int y; + int x; + + xbytes = sdraw->xalign * sdraw->width / 2; + palwork = np2_pal16[NP2PAL_TEXT2]; + pal = (UINT16)(palwork + (palwork >> 16)); + p = sdraw->dst; + y = sdraw->y; + do { + if (*(UINT16 *)(sdraw->dirty + y)) { + for (x=0; xwidth; x+=2) { + *(UINT16 *)p = pal; + p += sdraw->xalign; + } + p -= xbytes; + } + p += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->dst = p; + sdraw->y = y; +} + +// text or grph 1プレーン +static void SCRNCALL qvga16p_1(SDRAW sdraw, int maxy) { + + int xbytes; +const UINT8 *p; + UINT8 *q; + int y; + int x; + UINT32 work; + + xbytes = sdraw->xalign * sdraw->width / 2; + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (*(UINT16 *)(sdraw->dirty + y)) { + for (x=0; xwidth; x+=2) { + work = np2_pal16[p[x+0] + NP2PAL_GRPH]; + work += np2_pal16[p[x+1] + NP2PAL_GRPH]; + work += np2_pal16[p[x+0+SURFACE_WIDTH] + NP2PAL_GRPH]; + work += np2_pal16[p[x+1+SURFACE_WIDTH] + NP2PAL_GRPH]; + work &= 0x07e0f81f << 2; + *(UINT16 *)q = (UINT16)((work >> 2) + (work >> 18)); + q += sdraw->xalign; + } + q -= xbytes; + } + p += SURFACE_WIDTH * 2; + q += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// text + grph +static void SCRNCALL qvga16p_2(SDRAW sdraw, int maxy) { + + int xbytes; +const UINT8 *p; +const UINT8 *q; + UINT8 *r; + int y; + int x; + UINT32 work; + + xbytes = sdraw->xalign * sdraw->width / 2; + p = sdraw->src; + q = sdraw->src2; + r = sdraw->dst; + y = sdraw->y; + do { + if (*(UINT16 *)(sdraw->dirty + y)) { + for (x=0; xwidth; x+=2) { + work = np2_pal16[p[x+0] + q[x+0] + NP2PAL_GRPH]; + work += np2_pal16[p[x+1] + q[x+1] + NP2PAL_GRPH]; + work += np2_pal16[p[x+0+SURFACE_WIDTH] + + q[x+0+SURFACE_WIDTH] + NP2PAL_GRPH]; + work += np2_pal16[p[x+1+SURFACE_WIDTH] + + q[x+1+SURFACE_WIDTH] + NP2PAL_GRPH]; + work &= 0x07e0f81f << 2; + *(UINT16 *)r = (UINT16)((work >> 2) + (work >> 18)); + r += sdraw->xalign; + } + r -= xbytes; + } + p += SURFACE_WIDTH * 2; + q += SURFACE_WIDTH * 2; + r += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->src2 = q; + sdraw->dst = r; + sdraw->y = y; +} + +// text + (grph:interleave) - > qvga16p_1 + +// grph:interleave +static void SCRNCALL qvga16p_gi(SDRAW sdraw, int maxy) { + + int xbytes; +const UINT8 *p; + UINT8 *q; + int y; + int x; + UINT32 work; + + xbytes = sdraw->xalign * sdraw->width / 2; + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (*(UINT16 *)(sdraw->dirty + y)) { + for (x=0; xwidth; x+=2) { + work = np2_pal16[p[x+0] + NP2PAL_GRPH]; + work += np2_pal16[p[x+1] + NP2PAL_GRPH]; + work &= 0x07e0f81f << 1; + *(UINT16 *)q = (UINT16)((work >> 1) + (work >> 17)); + q += sdraw->xalign; + } + q -= xbytes; + } + p += SURFACE_WIDTH * 2; + q += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// text + grph:interleave +static void SCRNCALL qvga16p_2i(SDRAW sdraw, int maxy) { + + int xbytes; +const UINT8 *p; +const UINT8 *q; + UINT8 *r; + int y; + int x; + UINT32 work; + + xbytes = sdraw->xalign * sdraw->width / 2; + p = sdraw->src; + q = sdraw->src2; + r = sdraw->dst; + y = sdraw->y; + do { + if (*(UINT16 *)(sdraw->dirty + y)) { + for (x=0; xwidth; x+=2) { + work = np2_pal16[p[x+0] + q[x+0] + NP2PAL_GRPH]; + work += np2_pal16[p[x+1] + q[x+1] + NP2PAL_GRPH]; + if (q[x+0+SURFACE_WIDTH] & 0xf0) { + work += np2_pal16[(q[x+0+SURFACE_WIDTH] >> 4) + + NP2PAL_TEXT]; + } + else { + work += np2_pal16[p[x+0] + NP2PAL_GRPH]; + } + if (q[x+1+SURFACE_WIDTH] & 0xf0) { + work += np2_pal16[(q[x+1+SURFACE_WIDTH] >> 4) + + NP2PAL_TEXT]; + } + else { + work += np2_pal16[p[x+1] + NP2PAL_GRPH]; + } + work &= 0x07e0f81f << 2; + *(UINT16 *)r = (UINT16)((work >> 2) + (work >> 18)); + r += sdraw->xalign; + } + r -= xbytes; + } + p += SURFACE_WIDTH * 2; + q += SURFACE_WIDTH * 2; + r += sdraw->yalign; + y += 2; + } while(y < maxy); + + sdraw->src = p; + sdraw->src2 = q; + sdraw->dst = r; + sdraw->y = y; +} + +#if defined(SUPPORT_CRT15KHZ) +// text or grph 1プレーン (15kHz) +static void SCRNCALL qvga16p_1d(SDRAW sdraw, int maxy) { + + int xbytes; +const UINT8 *p; + UINT8 *q; + int y; + int x; + UINT32 work; + + xbytes = sdraw->xalign * sdraw->width / 2; + p = sdraw->src; + q = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x+=2) { + work = np2_pal16[p[x+0] + NP2PAL_GRPH]; + work += np2_pal16[p[x+1] + NP2PAL_GRPH]; + work &= 0x07e0f81f << 1; + *(UINT16 *)q = (UINT16)((work >> 1) + (work >> 17)); + q += sdraw->xalign; + } + q -= xbytes; + } + p += SURFACE_WIDTH; + q += sdraw->yalign; + } while(++y < maxy); + + sdraw->src = p; + sdraw->dst = q; + sdraw->y = y; +} + +// text + grph (15kHz) +static void SCRNCALL qvga16p_2d(SDRAW sdraw, int maxy) { + + int xbytes; +const UINT8 *p; +const UINT8 *q; + UINT8 *r; + int y; + int x; + UINT32 work; + + xbytes = sdraw->xalign * sdraw->width / 2; + p = sdraw->src; + q = sdraw->src2; + r = sdraw->dst; + y = sdraw->y; + do { + if (sdraw->dirty[y]) { + for (x=0; xwidth; x+=2) { + work = np2_pal16[p[x+0] + q[x+0] + NP2PAL_GRPH]; + work += np2_pal16[p[x+1] + q[x+1] + NP2PAL_GRPH]; + work &= 0x07e0f81f << 1; + *(UINT16 *)r = (UINT16)((work >> 1) + (work >> 17)); + r += sdraw->xalign; + } + r -= xbytes; + } + p += SURFACE_WIDTH; + q += SURFACE_WIDTH; + r += sdraw->yalign; + } while(++y < maxy); + + sdraw->src = p; + sdraw->src2 = q; + sdraw->dst = r; + sdraw->y = y; +} +#endif + + +static const SDRAWFN qvga16p[] = { + qvga16p_0, qvga16p_1, qvga16p_1, qvga16p_2, + qvga16p_0, qvga16p_1, qvga16p_gi, qvga16p_2i, + qvga16p_0, qvga16p_1, qvga16p_gi, qvga16p_2i, +#if defined(SUPPORT_CRT15KHZ) + qvga16p_0, qvga16p_1d, qvga16p_1d, qvga16p_2d, +#endif + }; + +const SDRAWFN *sdraw_getproctbl(const SCRNSURF *surf) { + + if (surf->bpp == 16) { + return(qvga16p); + } + else { + return(NULL); + } +} + +#endif + diff --git a/vram/videofilter.c b/vram/videofilter.c new file mode 100755 index 00000000..1d14bd18 --- /dev/null +++ b/vram/videofilter.c @@ -0,0 +1,1706 @@ +#include "videofilter.h" + +#if defined(SUPPORT_VIDEOFILTER) + +#include +#include +#include +#include +#include +#include +#include + +h_VideoFilterMng hVFMng1; + +static void RGBtoHSV_d(uint16_t* pu16H, uint8_t* pu8S, uint8_t* pu8V, const uint8_t u8R, const uint8_t u8G, const uint8_t u8B) { + int16_t i16H; + uint8_t u8D; + +// if(!pu16H || !pu8S || !pu8V) { +// return; +// } + + if(u8R == u8G && u8R == u8B) { + i16H = 0; + *pu8S = 0; + *pu8V = u8R; + } else if(u8R >= u8G && u8R >= u8B) { + if(u8B >= u8G) { + u8D = u8R - u8G; + i16H = 60 * ((int16_t)u8G - u8B) / u8D; + } else { + u8D = u8R - u8B; + i16H = 60 * ((int16_t)u8G - u8B) / u8D; + } + *pu8S = (uint8_t)((uint16_t)u8D * 255 / u8R); + *pu8V = u8R; + } else if(u8G >= u8R && u8G >= u8B) { + if(u8R >= u8B) { + u8D = u8G - u8B; + i16H = 60 * ((int16_t)u8B - u8R) / u8D + 120; + } else { + u8D = u8G - u8R; + i16H = 60 * ((int16_t)u8B - u8R) / u8D + 120; + } + *pu8S = (uint8_t)((uint16_t)u8D * 255 / u8G); + *pu8V = u8G; + } else { + if(u8G >= u8R) { + u8D = u8B - u8R; + i16H = 60 * ((int16_t)u8R - u8G) / u8D + 240; + } else { + u8D = u8B - u8G; + i16H = 60 * ((int16_t)u8R - u8G) / u8D + 240; + } + *pu8S = (uint8_t)((uint16_t)u8D * 255 / u8B); + *pu8V = u8B; + } + if(i16H < 0) { + i16H += 360; + } + *pu16H = (uint16_t)i16H; +} + +static uint32_t RGBtoHSV(const uint32_t u32RGB) { + uint8_t u8R = GETR(u32RGB); + uint8_t u8G = GETG(u32RGB); + uint8_t u8B = GETB(u32RGB); + int16_t u16H; + uint8_t u8S; + uint8_t u8V; + + RGBtoHSV_d(&u16H, &u8S, &u8V, u8R, u8G, u8B); + + return SETHSV(u16H, u8S, u8V); +} + +static void HSVtoRGB_d(uint8_t* pu8R, uint8_t* pu8G, uint8_t* pu8B, const uint16_t u16H, const uint8_t u8S, const uint8_t u8V) { + uint16_t u16UseH = u16H % 360; + uint8_t u8Min = u8V - (u8S * u8V) / 255; + uint8_t u8R, u8G, u8B; + +// if(!pu8R || !pu8G || !pu8B) { +// return; +// } + + if(u16UseH < 60) { + *pu8R = u8V; + *pu8G = u16UseH * (u8V - u8Min) / 60 + u8Min; + *pu8B = u8Min; + } else if(u16UseH >= 60 && u16UseH < 120) { + *pu8R = (120 - u16UseH) * (u8V - u8Min) / 60 + u8Min; + *pu8G = u8V; + *pu8B = u8Min; + } else if(u16UseH >= 120 && u16UseH < 180) { + *pu8R = u8Min; + *pu8G = u8V; + *pu8B = (u16UseH - 120) * (u8V - u8Min) / 60 + u8Min; + } else if(u16UseH >= 180 && u16UseH < 240) { + *pu8R = u8Min; + *pu8G = (240 - u16UseH) * (u8V - u8Min) / 60 + u8Min; + *pu8B = u8V; + } else if(u16UseH >= 240 && u16UseH < 300) { + *pu8R = (u16UseH - 240) * (u8V - u8Min) / 60 + u8Min; + *pu8G = u8Min; + *pu8B = u8V; + } else if(u16UseH >= 300 && u16UseH < 360) { + *pu8R = u8V; + *pu8G = u8Min; + *pu8B = (360 - u16UseH) * (u8V - u8Min) / 60 + u8Min; + } +} + +static uint32_t HSVtoRGB(const uint32_t u32HSV) { + uint16_t u16H = GETH(u32HSV); + uint8_t u8S = GETS(u32HSV); + uint8_t u8V = GETV(u32HSV); + uint8_t u8R; + uint8_t u8G; + uint8_t u8B; + + HSVtoRGB_d(&u8R, &u8G, &u8B, u16H, u8S, u8V); + + return SETRGB(u8R, u8G, u8B); +} + +static void RGBtoXYZ_d(uint8_t* pu8X, uint8_t* pu8Y, uint8_t* pu8Z, const uint8_t u8R, const uint8_t u8G, const uint8_t u8B) { +// if(!pu8X || !pu8Y || !pu8Z) { +// return; +// } + + // 0.4887180 0.3106803 0.2006017 + // 0.1762044 0.8129847 0.0108109 + // 0.0000000 0.0102048 0.9897952 + *pu8X = (488718 * u8R + 310680 * u8G + 200601 * u8B) / 1000000; + *pu8Y = (176204 * u8R + 812984 * u8G + 10810 * u8B) / 1000000; + *pu8Z = ( 0 * u8R + 10204 * u8G + 989795 * u8B) / 1000000; +} + +static uint32_t RGBtoXYZ(const uint32_t u32RGB) { + uint8_t u8R = GETR(u32RGB); + uint8_t u8G = GETG(u32RGB); + uint8_t u8B = GETB(u32RGB); + int16_t u8X; + uint8_t u8Y; + uint8_t u8Z; + + RGBtoHSV_d(&u8X, &u8Y, &u8Z, u8R, u8G, u8B); + + return SETXYZ(u8X, u8Y, u8Z); +} + +static uint32_t XYZtoRGB_d(uint8_t* pu8R, uint8_t* pu8G, uint8_t* pu8B, const uint8_t u8X, const uint8_t u8Y, const uint8_t u8Z) { +// if(!pu8R || !pu8G || !pu8B) { +// return; +// } + + // 2.3706743 -0.9000405 -0.4706338 + // -0.5138850 1.4253036 0.0885814 + // 0.0052982 -0.0146949 1.0093968 + *pu8R = (2370674 * u8X - 900040 * u8Y - 470633 * u8Z) / 1000000; + *pu8G = (1425303 * u8Y - 513885 * u8X + 88581 * u8Z) / 1000000; + *pu8B = ( 5298 * u8X - 14684 * u8Y + 1009396 * u8Z) / 1000000; +} + +static uint32_t XYZtoRGB(const uint32_t u32XYZ) { + uint8_t u8X = GETX(u32XYZ); + uint8_t u8Y = GETY(u32XYZ); + uint8_t u8Z = GETZ(u32XYZ); + uint8_t u8R; + uint8_t u8G; + uint8_t u8B; + + XYZtoRGB_d(&u8R, &u8G, &u8B, u8X, u8Y, u8Z); + + return SETRGB(u8R, u8G, u8B); +} + +enum { + VF_COLOR_TRANSPARENT = 1 << 25, + VF_COLOR_OUTOFRANGE, +}; + +enum { + VFE98_TYPE_THRU = 0, + VFE98_TYPE_TOPALLET, // pallet x to y + VFE98_TYPE_SWAP, // pallet swap x and y + VFE98_TYPE_TORGB, // pallet x to RGB + VFE98_TYPE_TOHSV, // pallet x to HSV +}; + +typedef struct VF_Palette_t_ { + union { + struct { + uint8_t u8B; + uint8_t u8G; + uint8_t u8R; + uint8_t u8Z; + } tRGB; + uint32_t u32RGB; + }; + union { + struct { + uint8_t u8V; + uint8_t u8S; + uint16_t u16H; + } tHSV; + uint32_t u32HSV; + }; +} VF_Palette_t; + +VF_Palette_t m_atPalette[256]; + +typedef union VF_Dot_t_ { + struct { + uint8_t u8B; + uint8_t u8G; + uint8_t u8R; + uint8_t u8Z; + } tRGB; + uint32_t u32RGB; +} VF_Dot_t; + +typedef union VF_WorkDot_t_ { + struct { + uint8_t u8B; + uint8_t u8G; + uint8_t u8R; + uint8_t u8Z; + } tRGB; + uint32_t u32RGB; + struct { + uint8_t u8V; + uint8_t u8S; + uint16_t u16H; + } tHSV; + uint32_t u32HSV; +} VF_WorkDot_t; + +typedef struct VF_CalcSample_t_ { + uint32_t u32X; + uint32_t u32Y; + uint8_t u8Weight; +} VF_CalcSample_t; + +typedef enum { + VFE_TYPE_THRU = 0, + VFE_TYPE_NP, + VFE_TYPE_DDOWN, + VFE_TYPE_GREY, + VFE_TYPE_GAMMA, + VFE_TYPE_ROTATEH, + VFE_TYPE_HSVSMOOTH, + VFE_TYPE_RGBSMOOTH, + + VFE_TYPE_END +} VFE_Type_t; + +typedef struct VFE_Base_t_ { + BOOL bEnable; + VFE_Type_t tType; +} VFE_Base_t; + +typedef struct VFE_NP_t_ { + VFE_Base_t tBase; +} VFE_NP_t; + +typedef struct VFE_DDown_t_ { + VFE_Base_t tBase; + uint32_t u32DDown; // down depth Dbit (default 0) : 0 <= D <= 7 +} VFE_DDown_t; + +typedef struct VFE_Grey_t_ { + VFE_Base_t tBase; + uint32_t u32Bit; // depth bit (default 8) : 0 <= D <= 8 + uint32_t u32H; // H of white (default 360) : 0 <= H <= 360 + uint32_t u32S; // S of white (default 100) : 0 <= S <= 255 + uint32_t u32V; // V of white (default 100) : 0 <= V <= 255 +} VFE_Grey_t; + +typedef struct VFE_Gamma_t_ { + VFE_Base_t tBase; + uint32_t u32Gamma; // Gamma G/10 (default 10) : 1 <= G <= 255 +} VFE_Gamma_t; + +typedef struct VFE_RotateH_t_ { + VFE_Base_t tBase; + uint32_t u32RotateH; // 0 <= H <= 360 (default 0) +} VFE_RotateH_t; + +typedef struct VFE_HSVSmooth_t_ { + VFE_Base_t tBase; + uint32_t u32Radius; // radius of range R/10dot units (default 5) : 5 <= R <= 25 + uint32_t u32Sample; // samples in range N*N (default 1) : 1 <= N <= 5 + uint32_t u32HDiff; // 0 <= dH (default 0) <= 180 + uint32_t u32SDiff; // 0 <= dS (default 0) <= 128 + uint32_t u32VDiff; // 0 <= dV (default 0) <= 128 + uint32_t u32WType; // weight type (default 0) 0:none 1:linear 2:sign +} VFE_HSVSmooth_t; + +typedef struct VFE_RGBSmooth_t_ { + VFE_Base_t tBase; + uint32_t u32Radius; // radius of range R/10dot units (default 5) : 5 <= R <= 25 + uint32_t u32Sample; // samples in range N*N (default 1) : 1 <= N <= 5 + uint32_t u32RDiff; // 0 <= dR (default 0) <= 128 + uint32_t u32GDiff; // 0 <= dG (default 0) <= 128 + uint32_t u32BDiff; // 0 <= dB (default 0) <= 128 + uint32_t u32WType; // weight type (default 0) 0:none 1:linear 2:sign +} VFE_RGBSmooth_t; + +typedef struct VFE_MaxParam_t_ { + VFE_Base_t tBase; + uint32_t au32Param[VF_PARAM_COUNT]; +} VFE_MaxParam_t; + +typedef union VFE_t_ { + VFE_Base_t tBase; + VFE_NP_t tNP; + VFE_DDown_t tDDown; + VFE_Grey_t tGrey; + VFE_Gamma_t tGamma; + VFE_RotateH_t tRotateH; + VFE_HSVSmooth_t tHSVSmooth; + VFE_RGBSmooth_t tRGBSmooth; + + VFE_MaxParam_t tMaxParam; +} VFE_t; + +typedef struct { + uint8_t u8FilterCount; + VFE_t atFilters[VF_FILTER_COUNT]; + uint8_t u8OutputNo; +} VF_Profile_t; + +typedef struct VF_Mng_t_ { + BOOL bEnable; + uint8_t u8ProfileCount; + VF_Profile_t atProfile[VF_PROFILE_COUNT]; + uint8_t u8ProfileNo; + uint8_t u8SetProfileNo; + + uint16_t u16MaxWidth; + uint16_t u16MaxHeight; + uint16_t u16Width; + uint16_t u16Height; + uint8_t u8MaxRadius; + BOOL bBufferMain; + VF_Dot_t* ptBuffer; + uint8_t* pu8VRAM; + uint8_t* pu8Dirty; + uint8_t* pu8DirtyOrg; + uint32_t u32Pallet; + uint8_t u8WorkSize; + VF_WorkDot_t* ptWork; + uint32_t au32WorkFF[256]; + uint16_t u16WorkX; + uint16_t u16WorkY; + uint16_t u16WorkSrcX; + uint16_t u16WorkSrcY; + BOOL bWorkHSV; + uint8_t u8MaxSample; + VF_CalcSample_t* ptCalcSample; +} VF_Mng_t; + +h_VideoFilterMng VideoFilter_Init(const uint16_t u16MaxWidth, const uint16_t u16MaxHeight, const uint8_t u8MaxRadius, const uint8_t u8MaxSample) { + VF_Mng_t* ptMng = NULL; + + if(!u16MaxWidth || u16MaxWidth < 640 || !u16MaxHeight || u16MaxWidth < 480 || !u8MaxRadius || u8MaxRadius < 5 || !u8MaxSample) { + return NULL; + } + + ptMng = (VF_Mng_t*)malloc(sizeof(VF_Mng_t)); + if(!ptMng) { + return NULL; + } + + memset(ptMng, 0, sizeof(VF_Mng_t)); + + ptMng->u16MaxWidth = u16MaxWidth; + ptMng->u16MaxHeight = u16MaxHeight; + ptMng->u16Width = 640; + ptMng->u16Height = 480; + ptMng->u8MaxRadius = u8MaxRadius; + ptMng->u8WorkSize = u8MaxRadius * 2; + ptMng->u8MaxSample = u8MaxSample; + + ptMng->ptBuffer = (VF_Dot_t*)malloc(ptMng->u16MaxWidth * ptMng->u16MaxHeight * 2 * sizeof(VF_Dot_t)); + if(!ptMng->ptBuffer) { + VideoFilter_Deinit(ptMng); + return NULL; + } + ptMng->pu8Dirty = (uint8_t*)malloc(u16MaxHeight); + if(!ptMng->pu8Dirty) { + VideoFilter_Deinit(ptMng); + return NULL; + } + ptMng->ptWork = (VF_WorkDot_t*)malloc(ptMng->u8WorkSize * ptMng->u8WorkSize * sizeof(VF_WorkDot_t)); + if(!ptMng->ptWork) { + VideoFilter_Deinit(ptMng); + return NULL; + } + ptMng->ptCalcSample = (VF_CalcSample_t*)malloc(u8MaxSample * u8MaxSample * sizeof(VF_CalcSample_t)); + if(!ptMng->ptCalcSample) { + VideoFilter_Deinit(ptMng); + return NULL; + } + + VideoFilter_SetSize(ptMng, 640, 480); + + return ptMng; +} + +void VideoFilter_Deinit(h_VideoFilterMng hMng) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + + if(!hMng) { + return; + } + + if(ptMng->ptBuffer) { + free(ptMng->ptBuffer); + } + if(ptMng->pu8Dirty) { + free(ptMng->pu8Dirty); + } + if(ptMng->ptWork) { + free(ptMng->ptWork); + } + if(ptMng->ptCalcSample) { + free(ptMng->ptCalcSample); + } + free(ptMng); +} + +void VideoFilterMng_LoadSetting( + h_VideoFilterMng hMng, + const BOOL bEnable, + const uint8_t u8ProfileCount, + const uint8_t u8ProfileNo +) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + uint8_t u8UseProfileNo = u8ProfileNo; + + if(!hMng || !u8ProfileCount) { + return; + } + if(u8ProfileNo >= u8ProfileCount) { + u8UseProfileNo = 0; + } + + ptMng->bEnable = bEnable; + ptMng->u8ProfileCount = u8ProfileCount; + ptMng->u8SetProfileNo = u8UseProfileNo; + ptMng->u8WorkSize = 0; + ptMng->bWorkHSV = FALSE; + + VideoFilter_SetSize(hMng, 640, 480); +} + +void VideoFilter_LoadProfile(h_VideoFilterMng hMng, const uint8_t u8ProfileNo, const uint8_t u8FilterCount, const uint8_t u8OutputNo) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + + if(!hMng) { + return; + } + if(u8ProfileNo >= ptMng->u8ProfileCount) { + return; + } + + ptMng->atProfile[u8ProfileNo].u8FilterCount = u8FilterCount; + if(u8OutputNo < ptMng->atProfile[u8ProfileNo].u8FilterCount) { + ptMng->atProfile[u8ProfileNo].u8OutputNo = u8OutputNo; + } else { + ptMng->atProfile[u8ProfileNo].u8OutputNo = 0; + } +} + +void VideoFilter_LoadFilter(h_VideoFilterMng hMng, const uint8_t u8ProfileNo, const uint8_t u8FilterNo, const uint32_t au32Param[2 + VF_PARAM_COUNT]) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + + if(!hMng) { + return; + } + if(u8ProfileNo >= ptMng->u8ProfileCount) { + return; + } + + if(u8FilterNo < ptMng->atProfile[u8ProfileNo].u8FilterCount) { + ptMng->atProfile[u8ProfileNo].atFilters[u8FilterNo].tBase.bEnable = au32Param[0]; + ptMng->atProfile[u8ProfileNo].atFilters[u8FilterNo].tBase.tType = au32Param[1]; + memcpy(ptMng->atProfile[u8ProfileNo].atFilters[u8FilterNo].tMaxParam.au32Param, &au32Param[2], VF_PARAM_COUNT * sizeof(uint32_t)); + } +} + +void VideoFilterMng_SaveSetting( + h_VideoFilterMng hMng, + BOOL* pbEnable, + uint8_t* pu8ProfileCount, + uint8_t* pu8ProfileNo +) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + + if(!hMng || !pbEnable || !pu8ProfileCount || !pu8ProfileNo) { + return; + } + + *pbEnable = ptMng->bEnable; + *pu8ProfileCount = ptMng->u8ProfileCount; + *pu8ProfileNo = ptMng->u8ProfileNo; +} + +void VideoFilter_SaveProfile(h_VideoFilterMng hMng, uint8_t* pu8FilterCount, uint8_t* pu8OutputNo, const uint8_t u8ProfileNo) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + + if(!hMng || !pu8FilterCount || !pu8OutputNo) { + return; + } + if(u8ProfileNo >= ptMng->u8ProfileCount) { + return; + } + + *pu8FilterCount = ptMng->atProfile[u8ProfileNo].u8FilterCount; + *pu8OutputNo = ptMng->atProfile[u8ProfileNo].u8OutputNo; +} + +void VideoFilter_SaveFilter(h_VideoFilterMng hMng, uint32_t au32Param[2 + VF_PARAM_COUNT], const uint8_t u8ProfileNo, const uint8_t u8FilterNo) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + + if(!hMng || au32Param) { + return; + } + if(u8ProfileNo >= ptMng->u8ProfileCount) { + return; + } + if(ptMng->atProfile[u8ProfileNo].u8FilterCount) { + return; + } + + au32Param[0] = ptMng->atProfile[u8ProfileNo].atFilters[u8FilterNo].tBase.bEnable; + au32Param[1] = ptMng->atProfile[u8ProfileNo].atFilters[u8FilterNo].tBase.tType; + memcpy(&au32Param[2], ptMng->atProfile[u8ProfileNo].atFilters[u8FilterNo].tMaxParam.au32Param, VF_PARAM_COUNT * sizeof(uint32_t)); +} + +BOOL VideoFilter_GetEnable(h_VideoFilterMng hMng) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + + if(!hMng) { + return FALSE; + } + + return ptMng->bEnable; +} + +void VideoFilter_SetEnable(h_VideoFilterMng hMng, const BOOL bEnable) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + + if(!hMng) { + return; + } + + ptMng->bEnable = bEnable ? TRUE : FALSE; +} + +BOOL VideoFilter_GetProfileNo(h_VideoFilterMng hMng) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + + if(!hMng) { + return FALSE; + } + + return ptMng->u8SetProfileNo; +} + +void VideoFilter_SetProfileNo(h_VideoFilterMng hMng, const uint8_t u8ProfileNo) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + + if(!hMng) { + return; + } + if(u8ProfileNo >= ptMng->u8ProfileCount) { + return; + } + + ptMng->u8SetProfileNo = u8ProfileNo; +} + +void VideoFilter_SetSize(h_VideoFilterMng hMng, const uint16_t u16Width, const uint16_t u16Height) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + + if(!hMng) { + return; + } + if(u16Width > ptMng->u16MaxWidth || u16Height > ptMng->u16MaxHeight) { + return; + } + + ptMng->u16Width = u16Width; + ptMng->u16Height = u16Height; + + memset(ptMng->ptBuffer, 0, ptMng->u16MaxWidth * ptMng->u16MaxHeight * sizeof(VF_Dot_t)); + memset(ptMng->pu8Dirty, 1, ptMng->u16MaxHeight); +} + +void VideoFilter_SetSrcRGB_d(h_VideoFilterMng hMng, const uint16_t u16X, const uint16_t u16Y, const uint8_t u8R, const uint8_t u8G, const uint8_t u8B) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + VF_Dot_t* ptSrc; + + if(!hMng) { + return; + } + + ptSrc = &ptMng->ptBuffer[ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + if(u16X < ptMng->u16Width && u16Y < ptMng->u16Height) { + ptSrc[u16Y * ptMng->u16Width + u16X].tRGB.u8R = u8R; + ptSrc[u16Y * ptMng->u16Width + u16X].tRGB.u8G = u8G; + ptSrc[u16Y * ptMng->u16Width + u16X].tRGB.u8B = u8B; + } +} + +void VideoFilter_SetSrcRGB(h_VideoFilterMng hMng, const uint16_t u16X, const uint16_t u16Y, const uint32_t u32RGB) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + VF_Dot_t* ptSrc; + + if(!hMng) { + return; + } + + ptSrc = &ptMng->ptBuffer[ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + if(u16X < ptMng->u16Width && u16Y < ptMng->u16Height) { + ptSrc[u16Y * ptMng->u16Width + u16X].u32RGB = u32RGB; + } +} + +void VideoFilter_SetSrcHSV_d(h_VideoFilterMng hMng, const uint16_t u16X, const uint16_t u16Y, const uint16_t u16H, const uint8_t u8S, const uint8_t u8V) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + VF_Dot_t* ptSrc; + VF_Dot_t* ptSrcPos; + uint16_t u16UseH = u16H % 360; + + if(!hMng) { + return; + } + + ptSrc = &ptMng->ptBuffer[ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + if(u16X < ptMng->u16Width && u16Y < ptMng->u16Height) { + ptSrcPos = &ptSrc[u16Y * ptMng->u16Width + u16X]; + HSVtoRGB_d(&ptSrcPos->tRGB.u8R, &ptSrcPos->tRGB.u8G, &ptSrcPos->tRGB.u8B, u16UseH, u8S, u8V); + } +} +void VideoFilter_SetSrcHSV(h_VideoFilterMng hMng, const uint16_t u16X, const uint16_t u16Y, const uint32_t u32HSV) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + VF_Dot_t* ptSrc; + VF_Dot_t* ptSrcPos; + + if(!hMng) { + return; + } + + ptSrc = &ptMng->ptBuffer[ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + if(u16X < ptMng->u16Width && u16Y < ptMng->u16Height) { + ptSrcPos = &ptSrc[u16Y * ptMng->u16Width + u16X]; + HSVtoRGB_d(&ptSrcPos->tRGB.u8R, &ptSrcPos->tRGB.u8G, &ptSrcPos->tRGB.u8B, GETH(u32HSV), GETS(u32HSV), GETV(u32HSV)); + } +} + +static void VideoFilter_SetPalette(BOOL bPalletEx) { + uint16_t u16Color; + uint32_t u32Pallet; + + memset(m_atPalette, 0, sizeof(VF_Palette_t) * 256); + +#if defined(SUPPORT_PC9821) + if(bPalletEx) { + u32Pallet = NP2PAL_GRPHEX; + } else { + u32Pallet = NP2PAL_GRPH; + } +#else + u32Pallet = NP2PAL_GRPH; +#endif + + for(u16Color = 0; u16Color < 256; u16Color++) { + m_atPalette[u16Color].u32RGB = np2_pal32[u16Color + u32Pallet].d; + RGBtoHSV_d( + &m_atPalette[u16Color].tHSV.u16H, + &m_atPalette[u16Color].tHSV.u8S, + &m_atPalette[u16Color].tHSV.u8V, + np2_pal32[u16Color + u32Pallet].p.r, + np2_pal32[u16Color + u32Pallet].p.g, + np2_pal32[u16Color + u32Pallet].p.b + ); + } +} + +void VideoFilter_Import98(h_VideoFilterMng hMng, uint8_t* pu8VRAM, uint8_t* pu8Dirty, BOOL bPalletEx) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + + if(!hMng || !pu8VRAM || !pu8Dirty) { + return; + } + +// VideoFilter_SetSize(hMng, SURFACE_WIDTH, SURFACE_HEIGHT); + ptMng->pu8VRAM = pu8VRAM; + +#if defined(SUPPORT_PC9821) + if(bPalletEx) { + ptMng->u32Pallet = NP2PAL_GRPHEX; + } else { + ptMng->u32Pallet = NP2PAL_GRPH; + } +#else + ptMng->u32Pallet = NP2PAL_GRPH; +#endif + VideoFilter_SetPalette(bPalletEx); + + memcpy(ptMng->pu8Dirty, pu8Dirty, ptMng->u16Height); + ptMng->pu8DirtyOrg = pu8Dirty; +} + +static void VideoFilter_Thru98(h_VideoFilterMng hMng) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + uint16_t u16X, u16Y; + VF_Dot_t* ptSrc; + VF_Dot_t* ptYSrc; + uint8_t* pu8YVRAMSrc; + + if(!hMng) { + return; + } + + ptSrc = &ptMng->ptBuffer[ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + if(ptMng->pu8Dirty[u16Y]) { + ptYSrc = &ptSrc[u16Y * ptMng->u16Width]; + pu8YVRAMSrc = &ptMng->pu8VRAM[u16Y * ptMng->u16Width]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + ptYSrc->tRGB.u8R = m_atPalette[*pu8YVRAMSrc].tRGB.u8R; + ptYSrc->tRGB.u8G = m_atPalette[*pu8YVRAMSrc].tRGB.u8G; + ptYSrc->tRGB.u8B = m_atPalette[*pu8YVRAMSrc].tRGB.u8B; + ptYSrc++; + pu8YVRAMSrc++; + } + } + } +} + +void VideoFilter_Import(h_VideoFilterMng hMng, void* pInputBuf, const uint8_t u8InputBPP, const uint16_t u16YAlign) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + uint16_t u16X, u16Y; + uint8_t* pu8YInput; + VF_Dot_t* ptSrc; + VF_Dot_t* ptSrcPos; + + if(!hMng || !pInputBuf || !u8InputBPP || !u16YAlign) { + return; + } + + ptSrc = &ptMng->ptBuffer[!ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + pu8YInput = &((uint8_t*)pInputBuf)[u16Y * u16YAlign]; + ptSrcPos = &ptSrc[u16Y * ptMng->u16Width]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + switch(u8InputBPP) { + case 16: + ptSrcPos->tRGB.u8R = (*(uint16_t*)pu8YInput >> 11) & 0x1F; + ptSrcPos->tRGB.u8G = (*(uint16_t*)pu8YInput >> 5) & 0x3F; + ptSrcPos->tRGB.u8B = *(uint16_t*)pu8YInput & 0x1F; + break; + case 24: + ptSrcPos->tRGB.u8R = pu8YInput[RGB24_R]; + ptSrcPos->tRGB.u8G = pu8YInput[RGB24_G]; + ptSrcPos->tRGB.u8B = pu8YInput[RGB24_B]; + break; + case 32: + ptSrcPos->u32RGB = *(uint32_t*)pu8YInput; + break; + } + pu8YInput += u8InputBPP; + } + } +} + +uint32_t* VideoFilter_GetDest(h_VideoFilterMng hMng) { + VF_Mng_t *ptMng = (VF_Mng_t *) hMng; + + if (hMng) { + return &ptMng->ptBuffer[!ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height].u32RGB; + } else { + return NULL; + } +} + +void VideoFilter_NP(h_VideoFilterMng hMng) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + uint16_t u16X, u16Y; + VF_Dot_t* ptSrc; + VF_Dot_t* ptDest; + uint8_t* pu8YVRAMSrc; + VF_Dot_t* ptYSrc; + VF_Dot_t* ptYDest; + + if(!hMng) { + return; + } + + ptDest = &ptMng->ptBuffer[!ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + if(ptMng->pu8VRAM) { + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + if(ptMng->pu8Dirty[u16Y]) { + pu8YVRAMSrc = &ptMng->pu8VRAM[ptMng->u16Width * u16Y]; + ptYDest = &ptDest[ptMng->u16Width * u16Y]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + ptYDest->u32RGB = ~(m_atPalette[*pu8YVRAMSrc].u32RGB) & 0x00FFFFFF; + pu8YVRAMSrc++; + ptYDest++; + } + } + } + } else { + ptSrc = &ptMng->ptBuffer[ ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + ptYSrc = &ptSrc[ptMng->u16Width * u16Y]; + ptYDest = &ptDest[ptMng->u16Width * u16Y]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + ptYDest->u32RGB = ~(ptYSrc->u32RGB) & 0x00FFFFFF; + ptYSrc++; + ptYDest++; + } + } + } +} + +void VideoFilter_DDown(h_VideoFilterMng hMng, const uint8_t u8DDown) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + uint16_t u16X, u16Y; + VF_Dot_t* ptSrc; + VF_Dot_t* ptDest; + uint8_t* pu8YVRAMSrc; + VF_Dot_t* ptYSrc; + VF_Dot_t* ptYDest; + uint8_t u8UseDDown = u8DDown; + uint8_t u8Div; + + if(!hMng) { + return; + } + + if(u8DDown > 8) { + u8UseDDown = 7; + } + + u8Div = (1 << (8 - u8DDown)) - 1; + + ptDest = &ptMng->ptBuffer[!ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + if(ptMng->pu8VRAM) { + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + if(ptMng->pu8Dirty[u16Y]) { + pu8YVRAMSrc = &ptMng->pu8VRAM[ptMng->u16Width * u16Y]; + ptYDest = &ptDest[ptMng->u16Width * u16Y]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + ptYDest->tRGB.u8R = (m_atPalette[*pu8YVRAMSrc].tRGB.u8R >> u8DDown) * 255 / u8Div; + ptYDest->tRGB.u8G = (m_atPalette[*pu8YVRAMSrc].tRGB.u8G >> u8DDown) * 255 / u8Div; + ptYDest->tRGB.u8B = (m_atPalette[*pu8YVRAMSrc].tRGB.u8B >> u8DDown) * 255 / u8Div; + pu8YVRAMSrc++; + ptYDest++; + } + } + } + } else { + ptSrc = &ptMng->ptBuffer[ ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + ptYSrc = &ptSrc[ptMng->u16Width * u16Y]; + ptYDest = &ptDest[ptMng->u16Width * u16Y]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + ptYDest->tRGB.u8R = (ptYSrc->tRGB.u8R >> u8DDown) * 255 / u8Div; + ptYDest->tRGB.u8G = (ptYSrc->tRGB.u8G >> u8DDown) * 255 / u8Div; + ptYDest->tRGB.u8B = (ptYSrc->tRGB.u8B >> u8DDown) * 255 / u8Div; + ptYSrc++; + ptYDest++; + } + } + } +} + +void VideoFilter_Grey(h_VideoFilterMng hMng, const uint8_t u8Bit, const uint16_t u16H, const uint8_t u8S, const uint8_t u8V) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + uint16_t u16X, u16Y; + VF_Dot_t* ptSrc; + VF_Dot_t* ptDest; + uint8_t* pu8YVRAMSrc; + VF_Dot_t* ptYSrc; + VF_Dot_t* ptYDest; + uint8_t u8R, u8G, u8B; + uint16_t u16UseH = u16H % 360; + uint8_t u8UseBit = u8Bit; + + if(!hMng) { + return; + } + + if(u8Bit > 8) { + u8UseBit = 8; + } + + ptDest = &ptMng->ptBuffer[!ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + if(ptMng->pu8VRAM) { + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + if(ptMng->pu8Dirty[u16Y]) { + pu8YVRAMSrc = &ptMng->pu8VRAM[ptMng->u16Width * u16Y]; + ptYDest = &ptDest[ptMng->u16Width * u16Y]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + ptYDest->u32RGB = + ((uint16_t)m_atPalette[*pu8YVRAMSrc].tRGB.u8R + + m_atPalette[*pu8YVRAMSrc].tRGB.u8G + + m_atPalette[*pu8YVRAMSrc].tRGB.u8B) / 3; + pu8YVRAMSrc++; + ptYDest++; + } + } + } + } else { + ptSrc = &ptMng->ptBuffer[ ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + ptYSrc = &ptSrc[ptMng->u16Width * u16Y]; + ptYDest = &ptDest[ptMng->u16Width * u16Y]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + ptYDest->u32RGB = ((uint16_t)ptYDest->tRGB.u8R + ptYDest->tRGB.u8G + ptYDest->tRGB.u8B) / 3; + ptYSrc++; + ptYDest++; + } + } + } + + ptMng->bBufferMain ^= 1; + ptSrc = &ptMng->ptBuffer[ ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + ptDest = &ptMng->ptBuffer[!ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + HSVtoRGB_d(&u8R, &u8G, &u8B, u16UseH, u8S, u8V); + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + ptYSrc = &ptSrc[ptMng->u16Width * u16Y]; + ptYDest = &ptDest[ptMng->u16Width * u16Y]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + ptYDest->tRGB.u8R = (ptYSrc->u32RGB * u8R) / 255; + ptYDest->tRGB.u8G = (ptYSrc->u32RGB * u8G) / 255; + ptYDest->tRGB.u8B = (ptYSrc->u32RGB * u8B) / 255; + ptYSrc++; + ptYDest++; + } + } +} + +void VideoFilter_Gamma(h_VideoFilterMng hMng, const uint8_t u8Gamma) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + uint16_t u16X, u16Y; + VF_Dot_t* ptSrc; + VF_Dot_t* ptDest; + uint8_t* pu8YVRAMSrc; + VF_Dot_t* ptYSrc; + VF_Dot_t* ptYDest; + uint8_t u8UseGamma = u8Gamma; + uint16_t u16H; + uint8_t u8S, u8V; + + if(!hMng) { + return; + } + + if(u8Gamma == 0) { + u8UseGamma = 1; + } + + for(u16X = 0; u16X < 256; u16X++) { + ptMng->au32WorkFF[u16X] = (uint8_t)(255 * pow(1.0 * u16X / 255, 1.0 / (u8UseGamma / 10.0))); + } + + ptDest = &ptMng->ptBuffer[!ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + if(ptMng->pu8VRAM) { + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + if(ptMng->pu8Dirty[u16Y]) { + pu8YVRAMSrc = &ptMng->pu8VRAM[ptMng->u16Width * u16Y]; + ptYDest = &ptDest[ptMng->u16Width * u16Y]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + ptYDest->u32RGB = HSVtoRGB(SETHSV( + m_atPalette[*pu8YVRAMSrc].tHSV.u16H, + m_atPalette[*pu8YVRAMSrc].tHSV.u8S, + ptMng->au32WorkFF[m_atPalette[*pu8YVRAMSrc].tHSV.u8V] + )); + pu8YVRAMSrc++; + ptYDest++; + } + } + } + } else { + ptSrc = &ptMng->ptBuffer[ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + ptYSrc = &ptSrc[ptMng->u16Width * u16Y]; + ptYDest = &ptDest[ptMng->u16Width * u16Y]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + RGBtoHSV_d(&u16H, &u8S, &u8V, ptYSrc->tRGB.u8R, ptYSrc->tRGB.u8G, ptYSrc->tRGB.u8B); + ptYDest->u32RGB = HSVtoRGB(SETHSV(u16H, u8S, ptMng->au32WorkFF[u8V])); + ptYSrc++; + ptYDest++; + } + } + } +} + +void VideoFilter_RotateH(h_VideoFilterMng hMng, const uint16_t u16RotateH) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + uint16_t u16X, u16Y; + VF_Dot_t* ptSrc; + VF_Dot_t* ptDest; + uint8_t* pu8YVRAMSrc; + VF_Dot_t* ptYSrc; + VF_Dot_t* ptYDest; + uint16_t u16UseRotateH = u16RotateH % 360; + uint16_t u16H; + uint8_t u8S, u8V; + + if(!hMng) { + return; + } + + ptDest = &ptMng->ptBuffer[!ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + if(ptMng->pu8VRAM) { + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + if(ptMng->pu8Dirty[u16Y]) { + pu8YVRAMSrc = &ptMng->pu8VRAM[ptMng->u16Width * u16Y]; + ptYDest = &ptDest[ptMng->u16Width * u16Y]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + ptYDest->u32RGB = HSVtoRGB(SETHSV( + (m_atPalette[*pu8YVRAMSrc].tHSV.u16H + u16UseRotateH) % 360, + m_atPalette[*pu8YVRAMSrc].tHSV.u8S, + m_atPalette[*pu8YVRAMSrc].tHSV.u8V + )); + pu8YVRAMSrc++; + ptYDest++; + } + } + } + } else { + ptSrc = &ptMng->ptBuffer[ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + ptYSrc = &ptSrc[ptMng->u16Width * u16Y]; + ptYDest = &ptDest[ptMng->u16Width * u16Y]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + RGBtoHSV_d(&u16H, &u8S, &u8V, ptYSrc->tRGB.u8R, ptYSrc->tRGB.u8G, ptYSrc->tRGB.u8B); + ptYDest->u32RGB = HSVtoRGB(SETHSV((u16H + u16UseRotateH) % 360, u8S, u8V)); + ptYSrc++; + ptYDest++; + } + } + } +} + +static void FetchWork(h_VideoFilterMng hMng) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + int16_t i16SelectX, i16SelectY; + VF_Dot_t* ptSrc; + uint8_t* pu8YVRAMSrc; + VF_Dot_t* ptSrcPos; + VF_WorkDot_t *ptWorkPos; + + if(!hMng) { + return; + } + + ptSrc = &ptMng->ptBuffer[ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + i16SelectY = (int16_t)ptMng->u16WorkSrcY - ptMng->u8WorkSize / 2; + for(ptMng->u16WorkY = 0; ptMng->u16WorkY < ptMng->u8WorkSize; ptMng->u16WorkY++) { + ptWorkPos = &ptMng->ptWork[ptMng->u16WorkY * ptMng->u8WorkSize]; + if(i16SelectY >= 0 && i16SelectY < ptMng->u16Height) { + i16SelectX = (int16_t)ptMng->u16WorkSrcX - ptMng->u8WorkSize / 2; + for(ptMng->u16WorkX = 0; ptMng->u16WorkX < ptMng->u8WorkSize; ptMng->u16WorkX++) { + if(i16SelectX >= 0 && i16SelectX < ptMng->u16Width) { + if(ptMng->pu8VRAM) { + pu8YVRAMSrc = &ptMng->pu8VRAM[i16SelectY * ptMng->u16Width + i16SelectX]; + if(ptMng->bWorkHSV) { + RGBtoHSV_d( + &ptWorkPos->tHSV.u16H, + &ptWorkPos->tHSV.u8S, + &ptWorkPos->tHSV.u8V, + m_atPalette[*pu8YVRAMSrc].tRGB.u8R, + m_atPalette[*pu8YVRAMSrc].tRGB.u8G, + m_atPalette[*pu8YVRAMSrc].tRGB.u8B + ); + } else { + ptWorkPos->u32RGB = m_atPalette[*pu8YVRAMSrc].u32RGB; + } + } else { + ptSrcPos = &ptSrc[i16SelectY * ptMng->u16Width + i16SelectX]; + if(ptMng->bWorkHSV) { + RGBtoHSV_d( + &ptWorkPos->tHSV.u16H, + &ptWorkPos->tHSV.u8S, + &ptWorkPos->tHSV.u8V, + ptSrcPos->tRGB.u8R, + ptSrcPos->tRGB.u8G, + ptSrcPos->tRGB.u8B + ); + } else { + ptWorkPos->u32RGB = ptSrcPos->u32RGB; + } + } + } else { + ptWorkPos->u32RGB = VF_COLOR_OUTOFRANGE; + } + ptWorkPos++; + i16SelectX++; + } + } else { + for(ptMng->u16WorkX = 0; ptMng->u16WorkX < ptMng->u8WorkSize; ptMng->u16WorkX++) { + ptWorkPos->u32RGB = VF_COLOR_OUTOFRANGE; + ptWorkPos++; + } + } + i16SelectY++; + } +} + +static void WorkRight(h_VideoFilterMng hMng) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + int16_t i16SelectX, i16SelectY; + VF_Dot_t *ptSrc; + uint8_t* pu8YVRAMSrc; + VF_Dot_t *ptSrcPos; + VF_WorkDot_t *ptWorkPos; + + if(!hMng) { + return; + } + + ptSrc = &ptMng->ptBuffer[ ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + for(ptMng->u16WorkY = 0; ptMng->u16WorkY < ptMng->u8WorkSize; ptMng->u16WorkY++) { + ptWorkPos = &ptMng->ptWork[ptMng->u16WorkY * ptMng->u8WorkSize]; + for(ptMng->u16WorkX = 0; ptMng->u16WorkX < ptMng->u8WorkSize - 1; ptMng->u16WorkX++) { + ptWorkPos->u32RGB = (ptWorkPos + 1)->u32RGB; + ptWorkPos++; + } + } + + i16SelectX = (int16_t)ptMng->u16WorkSrcX + ptMng->u8WorkSize / 2 + 1; + i16SelectY = (int16_t)ptMng->u16WorkSrcY - ptMng->u8WorkSize / 2; + for(ptMng->u16WorkY = 0; ptMng->u16WorkY < ptMng->u8WorkSize; ptMng->u16WorkY++) { + ptWorkPos = &ptMng->ptWork[ptMng->u16WorkY * ptMng->u8WorkSize + ptMng->u8WorkSize - 1]; + if(i16SelectX < ptMng->u16Width) { + if(i16SelectY >= 0 && i16SelectY < ptMng->u16Height) { + if(ptMng->pu8VRAM) { + pu8YVRAMSrc = &ptMng->pu8VRAM[i16SelectY * ptMng->u16Width + i16SelectX]; + if(ptMng->bWorkHSV) { + RGBtoHSV_d( + &ptWorkPos->tHSV.u16H, + &ptWorkPos->tHSV.u8S, + &ptWorkPos->tHSV.u8V, + m_atPalette[*pu8YVRAMSrc].tRGB.u8R, + m_atPalette[*pu8YVRAMSrc].tRGB.u8G, + m_atPalette[*pu8YVRAMSrc].tRGB.u8B + ); + } else { + ptWorkPos->u32RGB = m_atPalette[*pu8YVRAMSrc].u32RGB; + } + } else { + ptSrcPos = &ptSrc[i16SelectY * ptMng->u16Width + i16SelectX]; + if(ptMng->bWorkHSV) { + RGBtoHSV_d( + &ptWorkPos->tHSV.u16H, + &ptWorkPos->tHSV.u8S, + &ptWorkPos->tHSV.u8V, + ptSrcPos->tRGB.u8R, + ptSrcPos->tRGB.u8G, + ptSrcPos->tRGB.u8B + ); + } else { + ptWorkPos->u32RGB = ptSrcPos->u32RGB; + } + } + } else { + ptWorkPos->u32RGB = VF_COLOR_OUTOFRANGE; + } + } else { + ptWorkPos->u32RGB = VF_COLOR_OUTOFRANGE; + } + i16SelectY++; + } +} + +void VideoFilter_HSVSmooth(h_VideoFilterMng hMng, const uint8_t u8Radius, const uint8_t u8Sample, const uint8_t u8HDiff, const uint8_t u8SDiff, const uint8_t u8VDiff, const uint8_t u8WType) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + VF_Dot_t* ptDest; + VF_Dot_t* ptYDest; + VF_WorkDot_t* ptC; + VF_WorkDot_t* ptD; + uint8_t u8UseRadius = u8Radius; + uint8_t u8UseSample = u8Sample; + uint8_t u8UseHDiff = u8HDiff; + uint8_t u8UseSDiff = u8SDiff; + uint8_t u8UseVDiff = u8VDiff; + uint16_t u16CH; + int16_t i16DH, i16DS, i16DV; + int32_t i32AllH; + uint32_t u32AllS, u32AllV; + int16_t i16DY; + BOOL bCalc; + VF_CalcSample_t* ptCalcSample; + uint32_t u32Half; + uint32_t u32SampleCount; + uint8_t u8SampleX, u8SampleY; + + if(!hMng) { + return; + } + + if(u8Radius < 5) { + u8UseRadius = 5; + } else if(u8Radius > ptMng->u8MaxRadius) { + u8UseRadius = ptMng->u8MaxRadius; + } + ptMng->u8WorkSize = u8UseRadius * 2 / 10; + if(u8Sample == 0) { + u8UseSample = 1; + } else if(u8Sample > ptMng->u8MaxSample) { + u8UseSample = ptMng->u8MaxSample; + } + if(u8HDiff > 180) { + u8UseHDiff = 180; + } + if(u8SDiff > 128) { + u8UseSDiff = 128; + } + if(u8VDiff > 128) { + u8UseVDiff = 128; + } + + switch(u8WType) { + case 1: + for(u32SampleCount = 0; u32SampleCount < 90; u32SampleCount++) { + ptMng->au32WorkFF[u32SampleCount] = (uint8_t)(((90 - u32SampleCount) * 255) / 90); + } + break; + case 2: + for(u32SampleCount = 0; u32SampleCount < 90; u32SampleCount++) { + ptMng->au32WorkFF[u32SampleCount] = (uint8_t)(cos(u32SampleCount * 3.141592 / 180.0) * 255); + } + break; + default: + for(u32SampleCount = 0; u32SampleCount < 90; u32SampleCount++) { + ptMng->au32WorkFF[u32SampleCount] = 255; + } + break; + } + + u32Half = (uint32_t)((u8Radius * 10) / 1.414); // x100 + for(u8SampleY = 0; u8SampleY < u8UseSample; u8SampleY++) { + ptCalcSample = &ptMng->ptCalcSample[u8SampleY * u8UseSample]; + for(u8SampleX = 0; u8SampleX < u8UseSample; u8SampleX++) { + ptCalcSample->u32X = (((u32Half * 2) * u8SampleX / (u8UseSample - 1)) + u8UseRadius * 10 - u32Half) / 100; + ptCalcSample->u32Y = (((u32Half * 2) * u8SampleY / (u8UseSample - 1)) + u8UseRadius * 10 - u32Half) / 100; + ptCalcSample->u8Weight = ptMng->au32WorkFF[(uint32_t)sqrt(((int32_t)((u32Half * 2) * u8SampleX / (u8UseSample - 1)) - u32Half) * ((int32_t)((u32Half * 2) * u8SampleX / (u8UseSample - 1)) - u32Half) + ((int32_t)((u32Half * 2) * u8SampleY / (u8UseSample - 1)) - u32Half) * ((int32_t)((u32Half * 2) * u8SampleY / (u8UseSample - 1)) - u32Half)) * 90 / (u8Radius * 10)]; + ptCalcSample++; + } + } + + ptDest = &ptMng->ptBuffer[!ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + ptC = &ptMng->ptWork[(ptMng->u8WorkSize / 2) * ptMng->u8WorkSize + ptMng->u8WorkSize / 2]; + + ptMng->bWorkHSV = TRUE; + for(ptMng->u16WorkSrcY = 0; ptMng->u16WorkSrcY < ptMng->u16Height; ptMng->u16WorkSrcY++) { + bCalc = TRUE; + if(ptMng->pu8VRAM) { + bCalc = FALSE; + for(i16DY = ptMng->u16WorkSrcY - ptMng->u8WorkSize / 2; i16DY < ptMng->u16WorkSrcY + ptMng->u8WorkSize / 2 + 1; i16DY++) { + if(0 <= i16DY && i16DY <= ptMng->u16Height) { + if(ptMng->pu8Dirty[i16DY]) { + bCalc = TRUE; + break; + } + } + } + if(bCalc) { + for(i16DY = ptMng->u16WorkSrcY - ptMng->u8WorkSize / 2; i16DY < ptMng->u16WorkSrcY + ptMng->u8WorkSize / 2 + 1; i16DY++) { + if(0 <= i16DY && i16DY <= SURFACE_HEIGHT) { + ptMng->pu8DirtyOrg[i16DY] = 1; + } + } + } + } + if(bCalc) { + ptYDest = &ptDest[ptMng->u16WorkSrcY * ptMng->u16Width]; + ptMng->u16WorkSrcX = 0; + FetchWork(hMng); + for(; ptMng->u16WorkSrcX < ptMng->u16Width; ptMng->u16WorkSrcX++) { + i32AllH = u32AllS = u32AllV = 0; + u32SampleCount = 0; + for(u8SampleY = 0; u8SampleY < u8UseSample; u8SampleY++) { + ptCalcSample = &ptMng->ptCalcSample[u8SampleY * u8UseSample]; + for(u8SampleX = 0; u8SampleX < u8UseSample; u8SampleX++) { + ptD = &ptMng->ptWork[ptCalcSample->u32Y * ptMng->u8WorkSize + ptCalcSample->u32X]; + if(ptC->u32HSV == ptD->u32HSV) { + i32AllH += ptC->tHSV.u16H; + u32AllS += ptC->tHSV.u8S; + u32AllV += ptC->tHSV.u8V; + u32SampleCount++; + } else if(ptD->u32HSV != VF_COLOR_OUTOFRANGE) { + i16DH = ptD->tHSV.u16H - ptC->tHSV.u16H; + if(i16DH > 180) { + i16DH -= 360; + } else if(i16DH < -180) { + i16DH += 360; + } + if(!ptD->tHSV.u8S) { + i16DH = 0; + } + i16DS = ptD->tHSV.u8S - ptC->tHSV.u8S; + i16DV = ptD->tHSV.u8V - ptC->tHSV.u8V; + bCalc = TRUE; + if(bCalc) { + if(ptD->tHSV.u8V && (i16DH < -1 * u8UseHDiff || u8UseHDiff < i16DH)) { + bCalc = FALSE; + } + } + if(bCalc) { + if(ptD->tHSV.u8V && (i16DS < -1 * u8UseSDiff || u8UseSDiff < i16DS)) { + bCalc = FALSE; + } + } + if(bCalc) { + if(i16DV < -1 * u8UseVDiff || u8UseVDiff < i16DV) { + bCalc = FALSE; + } + } + if(bCalc) { + i32AllH += ptC->tHSV.u16H + (i16DH * ptCalcSample->u8Weight) / 255; + u32AllS += ptC->tHSV.u8S + (i16DS * ptCalcSample->u8Weight) / 255; + u32AllV += ptC->tHSV.u8V + (i16DV * ptCalcSample->u8Weight) / 255; + u32SampleCount++; + } + } + ptCalcSample++; + } + } + while(i32AllH < 0) { + i32AllH += 360; + } + i32AllH /= u32SampleCount; + if(i32AllH > 360) { + i32AllH %= 360; + } + HSVtoRGB_d( + &ptYDest->tRGB.u8R, + &ptYDest->tRGB.u8G, + &ptYDest->tRGB.u8B, + i32AllH, + u32AllS / u32SampleCount, + u32AllV / u32SampleCount + ); + ptYDest++; + WorkRight(hMng); + } + } + } +} + +void VideoFilter_RGBSmooth(h_VideoFilterMng hMng, const uint8_t u8Radius, const uint8_t u8Sample, const uint8_t u8RDiff, const uint8_t u8GDiff, const uint8_t u8BDiff, const uint8_t u8WType) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + VF_Dot_t* ptDest; + VF_Dot_t* ptYDest; + VF_WorkDot_t* ptC; + VF_WorkDot_t* ptD; + uint8_t u8UseRadius = u8Radius; + uint8_t u8UseSample = u8Sample; + uint8_t u8UseRDiff = u8RDiff; + uint8_t u8UseGDiff = u8GDiff; + uint8_t u8UseBDiff = u8BDiff; + int16_t i16DR, i16DG, i16DB; + uint32_t u32AllR, u32AllG, u32AllB; + int16_t i16DY; + BOOL bCalc; + VF_CalcSample_t* ptCalcSample; + uint32_t u32Half; + uint32_t u32SampleCount; + uint8_t u8SampleX, u8SampleY; + + if(!hMng) { + return; + } + + if(u8Radius < 5) { + u8UseRadius = 5; + } else if(u8Radius > ptMng->u8MaxRadius) { + u8UseRadius = ptMng->u8MaxRadius; + } + ptMng->u8WorkSize = u8UseRadius * 2 / 10; + if(u8Sample == 0) { + u8UseSample = 1; + } else if(u8Sample > ptMng->u8MaxSample) { + u8UseSample = ptMng->u8MaxSample; + } + if(u8RDiff > 128) { + u8UseRDiff = 128; + } + if(u8GDiff > 128) { + u8UseGDiff = 128; + } + if(u8BDiff > 128) { + u8UseBDiff = 128; + } + + switch(u8WType) { + case 1: + for(u32SampleCount = 0; u32SampleCount < 90; u32SampleCount++) { + ptMng->au32WorkFF[u32SampleCount] = (uint8_t)(((90 - u32SampleCount) * 255) / 90); + } + break; + case 2: + for(u32SampleCount = 0; u32SampleCount < 90; u32SampleCount++) { + ptMng->au32WorkFF[u32SampleCount] = (uint8_t)(cos(u32SampleCount * 3.141592 / 180.0) * 255); + } + break; + default: + for(u32SampleCount = 0; u32SampleCount < 90; u32SampleCount++) { + ptMng->au32WorkFF[u32SampleCount] = 255; + } + break; + } + + u32Half = (uint32_t)((u8Radius * 10) / 1.414); // x100 + for(u8SampleY = 0; u8SampleY < u8UseSample; u8SampleY++) { + ptCalcSample = &ptMng->ptCalcSample[u8SampleY * u8UseSample]; + for(u8SampleX = 0; u8SampleX < u8UseSample; u8SampleX++) { + ptCalcSample->u32X = (((u32Half * 2) * u8SampleX / (u8UseSample - 1)) + u8UseRadius * 10 - u32Half) / 100; + ptCalcSample->u32Y = (((u32Half * 2) * u8SampleY / (u8UseSample - 1)) + u8UseRadius * 10 - u32Half) / 100; + ptCalcSample->u8Weight = ptMng->au32WorkFF[(uint32_t)sqrt(((int32_t)((u32Half * 2) * u8SampleX / (u8UseSample - 1)) - u32Half) * ((int32_t)((u32Half * 2) * u8SampleX / (u8UseSample - 1)) - u32Half) + ((int32_t)((u32Half * 2) * u8SampleY / (u8UseSample - 1)) - u32Half) * ((int32_t)((u32Half * 2) * u8SampleY / (u8UseSample - 1)) - u32Half)) * 90 / (u8Radius * 10)]; + ptCalcSample++; + } + } + + ptDest = &ptMng->ptBuffer[!ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + ptC = &ptMng->ptWork[(ptMng->u8WorkSize / 2) * ptMng->u8WorkSize + ptMng->u8WorkSize / 2]; + + ptMng->bWorkHSV = FALSE; + for(ptMng->u16WorkSrcY = 0; ptMng->u16WorkSrcY < ptMng->u16Height; ptMng->u16WorkSrcY++) { + bCalc = TRUE; + if(ptMng->pu8VRAM) { + bCalc = FALSE; + for(i16DY = ptMng->u16WorkSrcY - ptMng->u8WorkSize / 2; i16DY < ptMng->u16WorkSrcY + ptMng->u8WorkSize / 2 + 1; i16DY++) { + if(0 <= i16DY && i16DY <= ptMng->u16Height) { + if(ptMng->pu8Dirty[i16DY]) { + bCalc = TRUE; + break; + } + } + } + if(bCalc) { + for(i16DY = ptMng->u16WorkSrcY - ptMng->u8WorkSize / 2; i16DY < ptMng->u16WorkSrcY + ptMng->u8WorkSize / 2 + 1; i16DY++) { + if(0 <= i16DY && i16DY <= SURFACE_HEIGHT) { + ptMng->pu8DirtyOrg[i16DY] = 1; + } + } + } + } + if(bCalc) { + ptYDest = &ptDest[ptMng->u16WorkSrcY * ptMng->u16Width]; + ptMng->u16WorkSrcX = 0; + FetchWork(hMng); + for(; ptMng->u16WorkSrcX < ptMng->u16Width; ptMng->u16WorkSrcX++) { + u32AllR = u32AllG = u32AllB = 0; + u32SampleCount = 0; + for(u8SampleY = 0; u8SampleY < u8UseSample; u8SampleY++) { + ptCalcSample = &ptMng->ptCalcSample[u8SampleY * u8UseSample]; + for(u8SampleX = 0; u8SampleX < u8UseSample; u8SampleX++) { + ptD = &ptMng->ptWork[ptCalcSample->u32Y * ptMng->u8WorkSize + ptCalcSample->u32X]; + if(ptC->u32RGB == ptD->u32RGB) { + u32AllR += ptC->tRGB.u8R; + u32AllG += ptC->tRGB.u8G; + u32AllB += ptC->tRGB.u8B; + u32SampleCount++; + } else if(ptD->u32RGB != VF_COLOR_OUTOFRANGE) { + i16DR = ptD->tRGB.u8R - ptC->tRGB.u8R; + i16DG = ptD->tRGB.u8G - ptC->tRGB.u8G; + i16DB = ptD->tRGB.u8B - ptC->tRGB.u8B; + bCalc = TRUE; + if(bCalc) { + if(i16DR < -1 * u8UseRDiff || u8UseRDiff < i16DR) { + bCalc = FALSE; + } + } + if(bCalc) { + if(i16DG < -1 * u8UseGDiff || u8UseGDiff < i16DG) { + bCalc = FALSE; + } + } + if(bCalc) { + if(i16DB < -1 * u8UseBDiff || u8UseBDiff < i16DB) { + bCalc = FALSE; + } + } + if(bCalc) { + u32AllR += ptC->tRGB.u8R + (i16DR * ptCalcSample->u8Weight) / 255; + u32AllG += ptC->tRGB.u8G + (i16DG * ptCalcSample->u8Weight) / 255; + u32AllB += ptC->tRGB.u8B + (i16DB * ptCalcSample->u8Weight) / 255; + u32SampleCount++; + } + } + ptCalcSample++; + } + } + ptYDest->tRGB.u8R = u32AllR / u32SampleCount; + ptYDest->tRGB.u8G = u32AllG / u32SampleCount; + ptYDest->tRGB.u8B = u32AllB / u32SampleCount; + ptYDest++; + WorkRight(hMng); + } + } + } +} + +void VideoFilter_Calc(h_VideoFilterMng hMng) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + VF_Profile_t* ptProfile; + VFE_t* ptFilter; + uint8_t i; + + if(!hMng) { + return; + } + + if(ptMng->u8ProfileNo != ptMng->u8SetProfileNo) { + memset(ptMng->pu8Dirty, 1, ptMng->u16Height); + if(ptMng->pu8VRAM) { + memset(ptMng->pu8DirtyOrg, 1, SURFACE_HEIGHT); + } + ptMng->u8ProfileNo = ptMng->u8SetProfileNo; + } + + if(ptMng->bEnable && ptMng->atProfile[ptMng->u8ProfileNo].atFilters[0].tBase.bEnable) { + ptProfile = &ptMng->atProfile[ptMng->u8ProfileNo]; + for(i = 0; i <= ptProfile->u8OutputNo && i < ptProfile->u8FilterCount; i++) { + ptFilter = &ptProfile->atFilters[i]; + if(ptFilter->tBase.bEnable) { + switch (ptFilter->tBase.tType) { + case VFE_TYPE_NP: + VideoFilter_NP(hMng); + break; + case VFE_TYPE_DDOWN: + VideoFilter_DDown( + hMng, + (uint8_t) ptFilter->tDDown.u32DDown + ); + break; + case VFE_TYPE_GREY: + VideoFilter_Grey( + hMng, + (uint8_t) ptFilter->tGrey.u32Bit, + (uint8_t) ptFilter->tGrey.u32H, + (uint8_t) ptFilter->tGrey.u32S, + (uint8_t) ptFilter->tGrey.u32V + ); + break; + case VFE_TYPE_GAMMA: + VideoFilter_Gamma( + hMng, + (uint8_t) ptFilter->tGamma.u32Gamma + ); + break; + case VFE_TYPE_ROTATEH: + VideoFilter_RotateH( + hMng, + (uint16_t) ptFilter->tRotateH.u32RotateH + ); + break; + case VFE_TYPE_HSVSMOOTH: + VideoFilter_HSVSmooth( + hMng, + (uint8_t) ptFilter->tHSVSmooth.u32Radius, + (uint8_t) ptFilter->tHSVSmooth.u32Sample, + (uint8_t) ptFilter->tHSVSmooth.u32HDiff, + (uint8_t) ptFilter->tHSVSmooth.u32SDiff, + (uint8_t) ptFilter->tHSVSmooth.u32VDiff, + (uint8_t) ptFilter->tHSVSmooth.u32WType + ); + break; + case VFE_TYPE_RGBSMOOTH: + VideoFilter_RGBSmooth( + hMng, + (uint8_t) ptFilter->tRGBSmooth.u32Radius, + (uint8_t) ptFilter->tRGBSmooth.u32Sample, + (uint8_t) ptFilter->tRGBSmooth.u32RDiff, + (uint8_t) ptFilter->tRGBSmooth.u32GDiff, + (uint8_t) ptFilter->tRGBSmooth.u32BDiff, + (uint8_t) ptFilter->tRGBSmooth.u32WType + ); + break; + default: + break; + } + ptMng->pu8VRAM = NULL; + } + } + } else { + if(ptMng->pu8VRAM) { + VideoFilter_Thru98(hMng); + } + ptMng->bBufferMain ^= 1; + ptMng->pu8VRAM = NULL; + } +} + +void VideoFilter_PutSrc(h_VideoFilterMng hMng, void* pOutput, const uint16_t u16X, const uint16_t u16Y, const uint8_t u8OutputBPP) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + VF_Dot_t* ptSrc; + VF_Dot_t* ptSrcPos; + + if(!hMng || !u8OutputBPP) { + return; + } + if(u16X >= ptMng->u16Width || u16Y >= ptMng->u16Height) { + return; + } + + ptSrc = &ptMng->ptBuffer[ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + ptSrcPos = &ptSrc[u16Y * ptMng->u16Width + u16X]; + switch(u8OutputBPP) { + case 2: +// *(uint16_t*)pOutput = (ptSrcPos->tRGB.u8B >> 3) | ((ptSrcPos->tRGB.u8G >> 3) << 5) | ((ptSrcPos->tRGB.u8R >> 3) << 11); // RGB555 + *(uint16_t*)pOutput = (ptSrcPos->tRGB.u8B >> 3) | ((ptSrcPos->tRGB.u8G >> 2) << 5) | ((ptSrcPos->tRGB.u8R >> 3) << 11); // RGB565 + break; + case 3: + ((uint8_t*)pOutput)[RGB24_R] = ptSrcPos->tRGB.u8R; + ((uint8_t*)pOutput)[RGB24_G] = ptSrcPos->tRGB.u8G; + ((uint8_t*)pOutput)[RGB24_B] = ptSrcPos->tRGB.u8B; + break; + case 4: + *(uint32_t*)pOutput = ptSrcPos->u32RGB; + break; + } +} + +void VideoFilter_PutDest(h_VideoFilterMng hMng, void* pOutput, const uint16_t u16X, const uint16_t u16Y, const uint8_t u8OutputBPP) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + VF_Dot_t* ptDest; + VF_Dot_t* ptDestPos; + + if(!hMng || !u8OutputBPP) { + return; + } + if(u16X >= ptMng->u16Width || u16Y >= ptMng->u16Height) { + return; + } + + ptDest = &ptMng->ptBuffer[!ptMng->bBufferMain * ptMng->u16Width * ptMng->u16Height]; + + ptDestPos = &ptDest[u16Y * ptMng->u16Width + u16X]; + switch(u8OutputBPP) { + case 2: +// *(uint16_t*)pOutput = (ptDestPos->tRGB.u8B >> 3) | ((ptDestPos->tRGB.u8G >> 3) << 5) | ((ptDestPos->tRGB.u8R >> 3) << 11); // RGB555 + *(uint16_t*)pOutput = (ptDestPos->tRGB.u8B >> 3) | ((ptDestPos->tRGB.u8G >> 2) << 5) | ((ptDestPos->tRGB.u8R >> 3) << 11); // RGB565 + break; + case 3: + ((uint8_t*)pOutput)[RGB24_R] = ptDestPos->tRGB.u8R; + ((uint8_t*)pOutput)[RGB24_G] = ptDestPos->tRGB.u8G; + ((uint8_t*)pOutput)[RGB24_B] = ptDestPos->tRGB.u8B; + break; + case 4: + *(uint32_t*)pOutput = ptDestPos->u32RGB; + break; + } +} + +void VideoFilter_ExportDest(h_VideoFilterMng hMng, void* pOutputBuf, const uint8_t u8OutputBPP, const uint16_t u16YAlign) { + VF_Mng_t* ptMng = (VF_Mng_t*)hMng; + uint16_t u16X, u16Y; + uint8_t* pu8YOutput; + + if(!hMng || !pOutputBuf || !u8OutputBPP || !u16YAlign) { + return; + } + + for(u16Y = 0; u16Y < ptMng->u16Height; u16Y++) { + pu8YOutput = &((uint8_t*)pOutputBuf)[u16Y * u16YAlign]; + for(u16X = 0; u16X < ptMng->u16Width; u16X++) { + VideoFilter_PutDest(hMng, pu8YOutput, u16X, u16Y, u8OutputBPP); + pu8YOutput += u8OutputBPP; + } + } +} + +#endif // SUPPORT_VIDEOFILTER + diff --git a/vram/videofilter.h b/vram/videofilter.h new file mode 100644 index 00000000..1c9bbd83 --- /dev/null +++ b/vram/videofilter.h @@ -0,0 +1,64 @@ +#ifndef _VIDEOFILTER_H_ +#define _VIDEOFILTER_H_ + +#include + +#define VF_PROFILE_COUNT 3 +#define VF_FILTER_COUNT 3 +#define VF_PARAM_COUNT 6 + +#define GETR(c) (uint8_t)(((c) & 0x00FF0000) >> 16) +#define GETG(c) (uint8_t)(((c) & 0x0000FF00) >> 8) +#define GETB(c) (uint8_t)( (c) & 0x000000FF ) +#define SETRGB(r, g, b) ((uint32_t)(b) | ((uint32_t)(g) << 8) | ((uint32_t)(r) << 16)) +#define GETH(c) (uint16_t)(((c) & 0x01FF0000) >> 16) +#define GETS(c) (uint8_t) (((c) & 0x0000FF00) >> 8) +#define GETV(c) (uint8_t) ( (c) & 0x000000FF) +#define SETHSV(h, s, v) ((uint32_t)(v) | ((uint32_t)(s) << 8) | ((uint32_t)(h) << 16)) +#define GETZ(c) (uint8_t)(((c) & 0x00FF0000) >> 16) +#define GETY(c) (uint8_t)(((c) & 0x0000FF00) >> 8) +#define GETX(c) (uint8_t)( (c) & 0x000000FF ) +#define SETXYZ(x, y, z) ((uint32_t)(z) | ((uint32_t)(y) << 8) | ((uint32_t)(x) << 16)) + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef void* h_VideoFilterMng; + +extern h_VideoFilterMng hVFMng1; + +h_VideoFilterMng VideoFilter_Init(const uint16_t u16MaxWidth, const uint16_t u16MaxHeight, const uint8_t u8MaxRadius, const uint8_t u8MaxSample); +void VideoFilter_Deinit(h_VideoFilterMng hMng); + +void VideoFilterMng_LoadSetting(h_VideoFilterMng hMng, const BOOL bEnable, const uint8_t u8ProfileCount, const uint8_t u8ProfileNo); +void VideoFilter_LoadProfile(h_VideoFilterMng hMng, const uint8_t u8ProfileNo, const uint8_t u8FilterCount, const uint8_t u8OutputNo); +void VideoFilter_LoadFilter(h_VideoFilterMng hMng, const uint8_t u8ProfileNo, const uint8_t u8FilterNo, const uint32_t au32Param[2 + VF_PARAM_COUNT]); +void VideoFilterMng_SaveSetting(h_VideoFilterMng hMng, BOOL* pbEnable, uint8_t* pu8ProfileCount, uint8_t* pu8ProfileNo); +void VideoFilter_SaveProfile(h_VideoFilterMng hMng, uint8_t* pu8FilterCount, uint8_t* pu8OutputNo, const uint8_t u8ProfileNo); +void VideoFilter_SaveFilter(h_VideoFilterMng hMng, uint32_t au32Param[2 + VF_PARAM_COUNT], const uint8_t u8ProfileNo, const uint8_t u8FilterNo); + +BOOL VideoFilter_GetEnable(h_VideoFilterMng hMng); +void VideoFilter_SetEnable(h_VideoFilterMng hMng, const BOOL bEnable); +void VideoFilter_SetSize(h_VideoFilterMng hMng, const uint16_t u16Width, const uint16_t u16Height); +BOOL VideoFilter_GetProfileNo(h_VideoFilterMng hMng); +void VideoFilter_SetProfileNo(h_VideoFilterMng hMng, const uint8_t u8ProfileNo); +void VideoFilter_SetSrcRGB_d(h_VideoFilterMng hMng, const uint16_t u16X, const uint16_t u16Y, const uint8_t u8R, const uint8_t u8G, const uint8_t u8B); +void VideoFilter_SetSrcRGB(h_VideoFilterMng hMng, const uint16_t u16X, const uint16_t u16Y, const uint32_t u32RGB); +void VideoFilter_SetSrcHSV_d(h_VideoFilterMng hMng, const uint16_t u16X, const uint16_t u16Y, const uint16_t u16H, const uint8_t u8S, const uint8_t u8V); +void VideoFilter_SetSrcHSV(h_VideoFilterMng hMng, const uint16_t u16X, const uint16_t u16Y, const uint32_t u32HSV); +void VideoFilter_Import98(h_VideoFilterMng hMng, uint8_t* pu8VRAM, uint8_t* pu8Dirty, BOOL bPalletEx); +void VideoFilter_Import(h_VideoFilterMng hMng, void* pInputBuf, const uint8_t u8InputBPP, const uint16_t u16YAlign); +void VideoFilter_Calc(h_VideoFilterMng hMng); +uint32_t* VideoFilter_GetDest(h_VideoFilterMng hMng); +void VideoFilter_PutSrc(h_VideoFilterMng hMng, void* pOutput, const uint16_t u16X, const uint16_t u16Y, const uint8_t u8OutputBPP); +void VideoFilter_PutDest(h_VideoFilterMng hMng, void* pOutput, const uint16_t u16X, const uint16_t u16Y, const uint8_t u8OutputBPP); +void VideoFilter_ExportSrc(h_VideoFilterMng hMng, void* pOutputBuf, const uint8_t u8OutputBPP, const uint16_t u16YAlign); +void VideoFilter_ExportDest(h_VideoFilterMng hMng, void* pOutputBuf, const uint8_t u8OutputBPP, const uint16_t u16YAlign); + +#if defined(__cplusplus) +} +#endif + +#endif // _VIDEOFILTER_H_ + diff --git a/vram/vram.c b/vram/vram.c old mode 100644 new mode 100755 index 05119980..85e1ca75 --- a/vram/vram.c +++ b/vram/vram.c @@ -1,24 +1,24 @@ -#include "compiler.h" -#include "cpucore.h" -#include "vram.h" - - - _VRAMOP vramop; - UINT8 tramupdate[0x1000]; - UINT8 vramupdate[0x8000]; -#if defined(SUPPORT_PC9821) -#if defined(SUPPORT_IA32_HAXM) - UINT8 vramex_base[0x80000]; // PEGC VRAM - UINT8 *vramex = vramex_base; // PEGC VRAM Alloc in pccore_mem_malloc() -#else - UINT8 vramex[0x80000]; // PEGC VRAM -#endif -#endif - - -void vram_initialize(void) { - - ZeroMemory(&vramop, sizeof(vramop)); - MEMM_VRAM(0); -} - +#include +#include +#include + + + _VRAMOP vramop; + UINT8 tramupdate[0x1000]; + UINT8 vramupdate[0x8000]; +#if defined(SUPPORT_PC9821) +#if defined(SUPPORT_IA32_HAXM) + UINT8 vramex_base[0x80000]; // PEGC VRAM + UINT8 *vramex = vramex_base; // PEGC VRAM Alloc in pccore_mem_malloc() +#else + UINT8 vramex[0x80000]; // PEGC VRAM +#endif +#endif + + +void vram_initialize(void) { + + ZeroMemory(&vramop, sizeof(vramop)); + MEMM_VRAM(0); +} + diff --git a/vram/vram.h b/vram/vram.h old mode 100644 new mode 100755 index 398cf3bf..7aa64a56 --- a/vram/vram.h +++ b/vram/vram.h @@ -1,73 +1,73 @@ - -#ifndef VRAMCALL -#define VRAMCALL -#endif - - -typedef struct { - UINT operate; -#if !defined(CPUSTRUC_MEMWAIT) - UINT tramwait; - UINT vramwait; - UINT grcgwait; -#endif -#if defined(SUPPORT_PC9821) - UINT8 mio1[4]; // PEGC Packed-pixel Mode ƒoƒ“ƒNΨ‚θ‘Φ‚¦(mio1[0`1] E0004H, mio1[2`3] E0006H) - UINT8 mio2[0x100]; // PEGC MMIOƒŒƒWƒXƒ^(mio2[0`1] E0100H ` E0200H) -#endif -} _VRAMOP, *VRAMOP; - -// operate: bit0 access page -// bit1 egc enable -// bit2 grcg bit6 -// bit3 grcg bit7 -// bit4 analog enable -// bit5 pc9821 vga - -enum { - VOPBIT_ACCESS = 0, - VOPBIT_EGC = 1, - VOPBIT_GRCG = 2, - VOPBIT_ANALOG = 4, - VOPBIT_VGA = 5 -}; - -// VOP_ACCESSBIT = 0x01, -// VOP_EGCBIT = 0x02, -// VOP_GRCGBIT = 0x0c, -// VOP_ANALOGBIT = 0x10, - -// VOP_ACCESSMASK = ~(0x01), -// VOP_EGCMASK = ~(0x02), -// VOP_GRCGMASK = ~(0x0c), -// VOP_ANALOGMASK = ~(0x10) - - -#ifdef __cplusplus -extern "C" { -#endif - -extern _VRAMOP vramop; -extern UINT8 tramupdate[0x1000]; -extern UINT8 vramupdate[0x8000]; -#if defined(SUPPORT_PC9821) -#if defined(SUPPORT_IA32_HAXM) -extern UINT8 vramex_base[0x80000]; -extern UINT8 *vramex; // PEGC VRAM Alloc in pccore_mem_malloc() -#else -extern UINT8 vramex[0x80000]; -#endif -#endif - -void vram_initialize(void); - -#if !defined(CPUSTRUC_MEMWAIT) -#define MEMWAIT_TRAM vramop.tramwait -#define MEMWAIT_VRAM vramop.vramwait -#define MEMWAIT_GRCG vramop.grcgwait -#endif - -#ifdef __cplusplus -} -#endif - + +#ifndef VRAMCALL +#define VRAMCALL +#endif + + +typedef struct { + UINT operate; +#if !defined(CPUSTRUC_MEMWAIT) + UINT tramwait; + UINT vramwait; + UINT grcgwait; +#endif +#if defined(SUPPORT_PC9821) + UINT8 mio1[4]; // PEGC Packed-pixel Mode γƒγƒ³γ‚―εˆ‡γ‚Šζ›Ώγˆ(mio1[0γ€œ1] E0004H, mio1[2γ€œ3] E0006H) + UINT8 mio2[0x100]; // PEGC MMIOレジスタ(mio2[0γ€œ1] E0100H γ€œ E0200H) +#endif +} _VRAMOP, *VRAMOP; + +// operate: bit0 access page +// bit1 egc enable +// bit2 grcg bit6 +// bit3 grcg bit7 +// bit4 analog enable +// bit5 pc9821 vga + +enum { + VOPBIT_ACCESS = 0, + VOPBIT_EGC = 1, + VOPBIT_GRCG = 2, + VOPBIT_ANALOG = 4, + VOPBIT_VGA = 5 +}; + +// VOP_ACCESSBIT = 0x01, +// VOP_EGCBIT = 0x02, +// VOP_GRCGBIT = 0x0c, +// VOP_ANALOGBIT = 0x10, + +// VOP_ACCESSMASK = ~(0x01), +// VOP_EGCMASK = ~(0x02), +// VOP_GRCGMASK = ~(0x0c), +// VOP_ANALOGMASK = ~(0x10) + + +#ifdef __cplusplus +extern "C" { +#endif + +extern _VRAMOP vramop; +extern UINT8 tramupdate[0x1000]; +extern UINT8 vramupdate[0x8000]; +#if defined(SUPPORT_PC9821) +#if defined(SUPPORT_IA32_HAXM) +extern UINT8 vramex_base[0x80000]; +extern UINT8 *vramex; // PEGC VRAM Alloc in pccore_mem_malloc() +#else +extern UINT8 vramex[0x80000]; +#endif +#endif + +void vram_initialize(void); + +#if !defined(CPUSTRUC_MEMWAIT) +#define MEMWAIT_TRAM vramop.tramwait +#define MEMWAIT_VRAM vramop.vramwait +#define MEMWAIT_GRCG vramop.grcgwait +#endif + +#ifdef __cplusplus +} +#endif + diff --git a/wab/cirrus_vga.c b/wab/cirrus_vga.c old mode 100755 new mode 100644 diff --git a/wab/cirrus_vga.h b/wab/cirrus_vga.h old mode 100755 new mode 100644 diff --git a/wab/cirrus_vga_extern.h b/wab/cirrus_vga_extern.h old mode 100755 new mode 100644 diff --git a/wab/cirrus_vga_rop.h b/wab/cirrus_vga_rop.h old mode 100755 new mode 100644 diff --git a/wab/cirrus_vga_rop2.h b/wab/cirrus_vga_rop2.h old mode 100755 new mode 100644 diff --git a/wab/vga_int.h b/wab/vga_int.h old mode 100755 new mode 100644 diff --git a/wab/wab.c b/wab/wab.c old mode 100755 new mode 100644 diff --git a/wab/wab.h b/wab/wab.h old mode 100755 new mode 100644 diff --git a/wab/wab_rly.c b/wab/wab_rly.c old mode 100755 new mode 100644 diff --git a/wab/wab_rly.h b/wab/wab_rly.h old mode 100755 new mode 100644 diff --git a/wab/wab_rly.res b/wab/wab_rly.res old mode 100755 new mode 100644 diff --git a/wab/wabbmpsave.h b/wab/wabbmpsave.h old mode 100755 new mode 100644 diff --git a/windows/commng.h b/windows/commng.h old mode 100755 new mode 100644 diff --git a/windows/commng/cmmidi.h b/windows/commng/cmmidi.h old mode 100755 new mode 100644 diff --git a/windows/commng/cmmidiin32.cpp b/windows/commng/cmmidiin32.cpp old mode 100755 new mode 100644 diff --git a/windows/commng/cmmidiin32.h b/windows/commng/cmmidiin32.h old mode 100755 new mode 100644 diff --git a/windows/commng/cmmidiout.h b/windows/commng/cmmidiout.h old mode 100755 new mode 100644 diff --git a/windows/commng/cmmidiout32.cpp b/windows/commng/cmmidiout32.cpp old mode 100755 new mode 100644 diff --git a/windows/commng/cmmidiout32.h b/windows/commng/cmmidiout32.h old mode 100755 new mode 100644 diff --git a/windows/commng/cmmidioutmt32sound.cpp b/windows/commng/cmmidioutmt32sound.cpp old mode 100755 new mode 100644 diff --git a/windows/commng/cmmidioutmt32sound.h b/windows/commng/cmmidioutmt32sound.h old mode 100755 new mode 100644 diff --git a/windows/commng/cmmidioutvermouth.cpp b/windows/commng/cmmidioutvermouth.cpp old mode 100755 new mode 100644 diff --git a/windows/commng/cmmidioutvermouth.h b/windows/commng/cmmidioutvermouth.h old mode 100755 new mode 100644 diff --git a/windows/commng/cmmidioutvst.cpp b/windows/commng/cmmidioutvst.cpp old mode 100755 new mode 100644 diff --git a/windows/commng/cmmidioutvst.h b/windows/commng/cmmidioutvst.h old mode 100755 new mode 100644 diff --git a/windows/commng/cmnull.cpp b/windows/commng/cmnull.cpp old mode 100755 new mode 100644 diff --git a/windows/commng/cmnull.h b/windows/commng/cmnull.h old mode 100755 new mode 100644 diff --git a/windows/commng/cmpara.cpp b/windows/commng/cmpara.cpp old mode 100755 new mode 100644 diff --git a/windows/commng/cmpara.h b/windows/commng/cmpara.h old mode 100755 new mode 100644 diff --git a/windows/commng/cmpipe.cpp b/windows/commng/cmpipe.cpp old mode 100755 new mode 100644 diff --git a/windows/commng/vsthost/vstbuffer.cpp b/windows/commng/vsthost/vstbuffer.cpp old mode 100755 new mode 100644 diff --git a/windows/commng/vsthost/vstbuffer.h b/windows/commng/vsthost/vstbuffer.h old mode 100755 new mode 100644 diff --git a/windows/commng/vsthost/vsteditwnd.cpp b/windows/commng/vsthost/vsteditwnd.cpp old mode 100755 new mode 100644 diff --git a/windows/commng/vsthost/vsteditwnd.h b/windows/commng/vsthost/vsteditwnd.h old mode 100755 new mode 100644 diff --git a/windows/commng/vsthost/vsteditwndbase.h b/windows/commng/vsthost/vsteditwndbase.h old mode 100755 new mode 100644 diff --git a/windows/commng/vsthost/vsteffect.cpp b/windows/commng/vsthost/vsteffect.cpp old mode 100755 new mode 100644 diff --git a/windows/commng/vsthost/vsteffect.h b/windows/commng/vsthost/vsteffect.h old mode 100755 new mode 100644 diff --git a/windows/commng/vsthost/vstmidievent.cpp b/windows/commng/vsthost/vstmidievent.cpp old mode 100755 new mode 100644 diff --git a/windows/commng/vsthost/vstmidievent.h b/windows/commng/vsthost/vstmidievent.h old mode 100755 new mode 100644 diff --git a/windows/commonfix.h b/windows/commonfix.h old mode 100755 new mode 100644 diff --git a/windows/compiler.cpp b/windows/compiler.cpp old mode 100755 new mode 100644 diff --git a/windows/compiler.h b/windows/compiler.h old mode 100755 new mode 100644 diff --git a/windows/debuguty/view1mb.cpp b/windows/debuguty/view1mb.cpp old mode 100755 new mode 100644 diff --git a/windows/debuguty/view1mb.h b/windows/debuguty/view1mb.h old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewasm.cpp b/windows/debuguty/viewasm.cpp old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewasm.h b/windows/debuguty/viewasm.h old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewer.cpp b/windows/debuguty/viewer.cpp old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewer.h b/windows/debuguty/viewer.h old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewitem.cpp b/windows/debuguty/viewitem.cpp old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewitem.h b/windows/debuguty/viewitem.h old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewmem.cpp b/windows/debuguty/viewmem.cpp old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewmem.h b/windows/debuguty/viewmem.h old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewreg.cpp b/windows/debuguty/viewreg.cpp old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewreg.h b/windows/debuguty/viewreg.h old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewseg.cpp b/windows/debuguty/viewseg.cpp old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewseg.h b/windows/debuguty/viewseg.h old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewsnd.cpp b/windows/debuguty/viewsnd.cpp old mode 100755 new mode 100644 diff --git a/windows/debuguty/viewsnd.h b/windows/debuguty/viewsnd.h old mode 100755 new mode 100644 diff --git a/windows/dialog/c_combodata.cpp b/windows/dialog/c_combodata.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/c_combodata.h b/windows/dialog/c_combodata.h old mode 100755 new mode 100644 diff --git a/windows/dialog/c_dipsw.cpp b/windows/dialog/c_dipsw.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/c_dipsw.h b/windows/dialog/c_dipsw.h old mode 100755 new mode 100644 diff --git a/windows/dialog/c_midi.cpp b/windows/dialog/c_midi.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/c_midi.h b/windows/dialog/c_midi.h old mode 100755 new mode 100644 diff --git a/windows/dialog/c_slidervalue.cpp b/windows/dialog/c_slidervalue.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/c_slidervalue.h b/windows/dialog/c_slidervalue.h old mode 100755 new mode 100644 diff --git a/windows/dialog/d_about.cpp b/windows/dialog/d_about.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_bmp.cpp b/windows/dialog/d_bmp.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_bms.cpp b/windows/dialog/d_bms.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_cfgload.cpp b/windows/dialog/d_cfgload.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_cfgsave.cpp b/windows/dialog/d_cfgsave.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_clnd.cpp b/windows/dialog/d_clnd.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_font.cpp b/windows/dialog/d_font.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_hostdrv.cpp b/windows/dialog/d_hostdrv.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_ide.cpp b/windows/dialog/d_ide.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_network.cpp b/windows/dialog/d_network.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_pci.cpp b/windows/dialog/d_pci.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_screen.cpp b/windows/dialog/d_screen.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_soundlog.cpp b/windows/dialog/d_soundlog.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_txt.cpp b/windows/dialog/d_txt.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/d_wab.cpp b/windows/dialog/d_wab.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/dialog.h b/windows/dialog/dialog.h old mode 100755 new mode 100644 diff --git a/windows/dialog/np2class.cpp b/windows/dialog/np2class.cpp old mode 100755 new mode 100644 diff --git a/windows/dialog/np2class.h b/windows/dialog/np2class.h old mode 100755 new mode 100644 diff --git a/windows/dialog/winfiledlg.c b/windows/dialog/winfiledlg.c old mode 100755 new mode 100644 diff --git a/windows/dialog/winfiledlg.h b/windows/dialog/winfiledlg.h old mode 100755 new mode 100644 diff --git a/windows/dosio.cpp b/windows/dosio.cpp old mode 100755 new mode 100644 diff --git a/windows/dosio.h b/windows/dosio.h old mode 100755 new mode 100644 diff --git a/windows/ext/c86ctl/c86ctl.h b/windows/ext/c86ctl/c86ctl.h old mode 100755 new mode 100644 diff --git a/windows/ext/c86ctl/c86ctlif.cpp b/windows/ext/c86ctl/c86ctlif.cpp old mode 100755 new mode 100644 diff --git a/windows/ext/c86ctl/c86ctlif.h b/windows/ext/c86ctl/c86ctlif.h old mode 100755 new mode 100644 diff --git a/windows/ext/c86ctl/cbus_boardtype.h b/windows/ext/c86ctl/cbus_boardtype.h old mode 100755 new mode 100644 diff --git a/windows/ext/externalchip.h b/windows/ext/externalchip.h old mode 100755 new mode 100644 diff --git a/windows/ext/externalchipmanager.cpp b/windows/ext/externalchipmanager.cpp old mode 100755 new mode 100644 diff --git a/windows/ext/externalchipmanager.h b/windows/ext/externalchipmanager.h old mode 100755 new mode 100644 diff --git a/windows/ext/externalopl3.cpp b/windows/ext/externalopl3.cpp old mode 100755 new mode 100644 diff --git a/windows/ext/externalopl3.h b/windows/ext/externalopl3.h old mode 100755 new mode 100644 diff --git a/windows/ext/externalopm.cpp b/windows/ext/externalopm.cpp old mode 100755 new mode 100644 diff --git a/windows/ext/externalopm.h b/windows/ext/externalopm.h old mode 100755 new mode 100644 diff --git a/windows/ext/externalopna.cpp b/windows/ext/externalopna.cpp old mode 100755 new mode 100644 diff --git a/windows/ext/externalopna.h b/windows/ext/externalopna.h old mode 100755 new mode 100644 diff --git a/windows/ext/externalpsg.cpp b/windows/ext/externalpsg.cpp old mode 100755 new mode 100644 diff --git a/windows/ext/externalpsg.h b/windows/ext/externalpsg.h old mode 100755 new mode 100644 diff --git a/windows/ext/mt32snd.cpp b/windows/ext/mt32snd.cpp old mode 100755 new mode 100644 diff --git a/windows/ext/mt32snd.h b/windows/ext/mt32snd.h old mode 100755 new mode 100644 diff --git a/windows/ext/opl3.cpp b/windows/ext/opl3.cpp old mode 100755 new mode 100644 diff --git a/windows/ext/romeo/juliet.cpp b/windows/ext/romeo/juliet.cpp old mode 100755 new mode 100644 diff --git a/windows/ext/romeo/juliet.h b/windows/ext/romeo/juliet.h old mode 100755 new mode 100644 diff --git a/windows/ext/romeo/romeo.h b/windows/ext/romeo/romeo.h old mode 100755 new mode 100644 diff --git a/windows/ext/scci/SCCIDefines.h b/windows/ext/scci/SCCIDefines.h old mode 100755 new mode 100644 diff --git a/windows/ext/scci/scci.h b/windows/ext/scci/scci.h old mode 100755 new mode 100644 diff --git a/windows/ext/scci/scciif.cpp b/windows/ext/scci/scciif.cpp old mode 100755 new mode 100644 diff --git a/windows/ext/scci/scciif.h b/windows/ext/scci/scciif.h old mode 100755 new mode 100644 diff --git a/windows/fontmng.cpp b/windows/fontmng.cpp old mode 100755 new mode 100644 diff --git a/windows/fontmng.h b/windows/fontmng.h old mode 100755 new mode 100644 diff --git a/windows/ini.h b/windows/ini.h old mode 100755 new mode 100644 diff --git a/windows/joymng.h b/windows/joymng.h old mode 100755 new mode 100644 diff --git a/windows/menu.h b/windows/menu.h old mode 100755 new mode 100644 diff --git a/windows/misc/DlgProc.cpp b/windows/misc/DlgProc.cpp old mode 100755 new mode 100644 diff --git a/windows/misc/DlgProc.h b/windows/misc/DlgProc.h old mode 100755 new mode 100644 diff --git a/windows/misc/PropProc.cpp b/windows/misc/PropProc.cpp old mode 100755 new mode 100644 diff --git a/windows/misc/PropProc.h b/windows/misc/PropProc.h old mode 100755 new mode 100644 diff --git a/windows/misc/WndBase.h b/windows/misc/WndBase.h old mode 100755 new mode 100644 diff --git a/windows/misc/WndProc.cpp b/windows/misc/WndProc.cpp old mode 100755 new mode 100644 diff --git a/windows/misc/WndProc.h b/windows/misc/WndProc.h old mode 100755 new mode 100644 diff --git a/windows/misc/extrom.cpp b/windows/misc/extrom.cpp old mode 100755 new mode 100644 diff --git a/windows/misc/extrom.h b/windows/misc/extrom.h old mode 100755 new mode 100644 diff --git a/windows/misc/guard.h b/windows/misc/guard.h old mode 100755 new mode 100644 diff --git a/windows/misc/threadbase.cpp b/windows/misc/threadbase.cpp old mode 100755 new mode 100644 diff --git a/windows/misc/threadbase.h b/windows/misc/threadbase.h old mode 100755 new mode 100644 diff --git a/windows/misc/tickcounter.cpp b/windows/misc/tickcounter.cpp old mode 100755 new mode 100644 diff --git a/windows/misc/tickcounter.h b/windows/misc/tickcounter.h old mode 100755 new mode 100644 diff --git a/windows/misc/trace.cpp b/windows/misc/trace.cpp old mode 100755 new mode 100644 diff --git a/windows/misc/trace.h b/windows/misc/trace.h old mode 100755 new mode 100644 diff --git a/windows/misc/tstring.cpp b/windows/misc/tstring.cpp old mode 100755 new mode 100644 diff --git a/windows/misc/tstring.h b/windows/misc/tstring.h old mode 100755 new mode 100644 diff --git a/windows/misc/vc6macros.h b/windows/misc/vc6macros.h old mode 100755 new mode 100644 diff --git a/windows/mousemng.h b/windows/mousemng.h old mode 100755 new mode 100644 diff --git a/windows/np2.h b/windows/np2.h old mode 100755 new mode 100644 diff --git a/windows/np2arg.cpp b/windows/np2arg.cpp old mode 100755 new mode 100644 diff --git a/windows/np2arg.h b/windows/np2arg.h old mode 100755 new mode 100644 diff --git a/windows/oemtext.cpp b/windows/oemtext.cpp old mode 100755 new mode 100644 diff --git a/windows/oemtext.h b/windows/oemtext.h old mode 100755 new mode 100644 diff --git a/windows/readme.txt b/windows/readme.txt old mode 100755 new mode 100644 diff --git a/windows/recvideo.cpp b/windows/recvideo.cpp old mode 100755 new mode 100644 diff --git a/windows/recvideo.h b/windows/recvideo.h old mode 100755 new mode 100644 diff --git a/windows/resources/1252/np2vs2019_1252.sln b/windows/resources/1252/np2vs2019_1252.sln old mode 100755 new mode 100644 diff --git a/windows/resources/1252/np2vs2019_1252.vcxproj b/windows/resources/1252/np2vs2019_1252.vcxproj old mode 100755 new mode 100644 diff --git a/windows/resources/1252/np2vs2019_1252.vcxproj.filters b/windows/resources/1252/np2vs2019_1252.vcxproj.filters old mode 100755 new mode 100644 diff --git a/windows/resources/932/np2vs2019_932.sln b/windows/resources/932/np2vs2019_932.sln old mode 100755 new mode 100644 diff --git a/windows/resources/932/np2vs2019_932.vcxproj b/windows/resources/932/np2vs2019_932.vcxproj old mode 100755 new mode 100644 diff --git a/windows/resources/932/np2vs2019_932.vcxproj.filters b/windows/resources/932/np2vs2019_932.vcxproj.filters old mode 100755 new mode 100644 diff --git a/windows/resources/936/np2vs2019_936.sln b/windows/resources/936/np2vs2019_936.sln old mode 100755 new mode 100644 diff --git a/windows/resources/936/np2vs2019_936.vcxproj b/windows/resources/936/np2vs2019_936.vcxproj old mode 100755 new mode 100644 diff --git a/windows/resources/936/np2vs2019_936.vcxproj.filters b/windows/resources/936/np2vs2019_936.vcxproj.filters old mode 100755 new mode 100644 diff --git a/windows/resources/950/np2vs2019_950.sln b/windows/resources/950/np2vs2019_950.sln old mode 100755 new mode 100644 diff --git a/windows/resources/950/np2vs2019_950.vcxproj b/windows/resources/950/np2vs2019_950.vcxproj old mode 100755 new mode 100644 diff --git a/windows/resources/950/np2vs2019_950.vcxproj.filters b/windows/resources/950/np2vs2019_950.vcxproj.filters old mode 100755 new mode 100644 diff --git a/windows/resources/fddseek1.wav b/windows/resources/fddseek1.wav old mode 100755 new mode 100644 diff --git a/windows/resources/mmxnp2.ico b/windows/resources/mmxnp2.ico old mode 100755 new mode 100644 diff --git a/windows/resources/nekop2.bmp b/windows/resources/nekop2.bmp old mode 100755 new mode 100644 diff --git a/windows/resources/np2.ico b/windows/resources/np2.ico old mode 100755 new mode 100644 diff --git a/windows/resources/np2debug.ico b/windows/resources/np2debug.ico old mode 100755 new mode 100644 diff --git a/windows/resources/np2tool.bmp b/windows/resources/np2tool.bmp old mode 100755 new mode 100644 diff --git a/windows/resources/np2vm.ico b/windows/resources/np2vm.ico old mode 100755 new mode 100644 diff --git a/windows/resources/np2vs2005.sln b/windows/resources/np2vs2005.sln old mode 100755 new mode 100644 diff --git a/windows/resources/np2vs2008.sln b/windows/resources/np2vs2008.sln old mode 100755 new mode 100644 diff --git a/windows/resources/relay1.wav b/windows/resources/relay1.wav old mode 100755 new mode 100644 diff --git a/windows/resources/resource.cpp b/windows/resources/resource.cpp old mode 100755 new mode 100644 diff --git a/windows/soundmng/asio/asiodriverlist.cpp b/windows/soundmng/asio/asiodriverlist.cpp old mode 100755 new mode 100644 diff --git a/windows/soundmng/asio/asiodriverlist.h b/windows/soundmng/asio/asiodriverlist.h old mode 100755 new mode 100644 diff --git a/windows/soundmng/asio/asiosdk.h b/windows/soundmng/asio/asiosdk.h old mode 100755 new mode 100644 diff --git a/windows/soundmng/sdasio.cpp b/windows/soundmng/sdasio.cpp old mode 100755 new mode 100644 diff --git a/windows/soundmng/sdasio.h b/windows/soundmng/sdasio.h old mode 100755 new mode 100644 diff --git a/windows/soundmng/sdbase.h b/windows/soundmng/sdbase.h old mode 100755 new mode 100644 diff --git a/windows/soundmng/sddsound3.h b/windows/soundmng/sddsound3.h old mode 100755 new mode 100644 diff --git a/windows/soundmng/sdwasapi.cpp b/windows/soundmng/sdwasapi.cpp old mode 100755 new mode 100644 diff --git a/windows/soundmng/sdwasapi.h b/windows/soundmng/sdwasapi.h old mode 100755 new mode 100644 diff --git a/windows/subwnd/dclock.cpp b/windows/subwnd/dclock.cpp old mode 100755 new mode 100644 diff --git a/windows/subwnd/dclock.h b/windows/subwnd/dclock.h old mode 100755 new mode 100644 diff --git a/windows/subwnd/dd2.cpp b/windows/subwnd/dd2.cpp old mode 100755 new mode 100644 diff --git a/windows/subwnd/dd2.h b/windows/subwnd/dd2.h old mode 100755 new mode 100644 diff --git a/windows/subwnd/kdispwnd.cpp b/windows/subwnd/kdispwnd.cpp old mode 100755 new mode 100644 diff --git a/windows/subwnd/kdispwnd.h b/windows/subwnd/kdispwnd.h old mode 100755 new mode 100644 diff --git a/windows/subwnd/mdbgwnd.cpp b/windows/subwnd/mdbgwnd.cpp old mode 100755 new mode 100644 diff --git a/windows/subwnd/mdbgwnd.h b/windows/subwnd/mdbgwnd.h old mode 100755 new mode 100644 diff --git a/windows/subwnd/skbdwnd.cpp b/windows/subwnd/skbdwnd.cpp old mode 100755 new mode 100644 diff --git a/windows/subwnd/skbdwnd.h b/windows/subwnd/skbdwnd.h old mode 100755 new mode 100644 diff --git a/windows/subwnd/subwnd.cpp b/windows/subwnd/subwnd.cpp old mode 100755 new mode 100644 diff --git a/windows/subwnd/subwnd.h b/windows/subwnd/subwnd.h old mode 100755 new mode 100644 diff --git a/windows/subwnd/toolwnd.cpp b/windows/subwnd/toolwnd.cpp old mode 100755 new mode 100644 diff --git a/windows/subwnd/toolwnd.h b/windows/subwnd/toolwnd.h old mode 100755 new mode 100644 diff --git a/windows/subwnd/toolwnd.res b/windows/subwnd/toolwnd.res old mode 100755 new mode 100644 diff --git a/windows/targetver.h b/windows/targetver.h old mode 100755 new mode 100644 diff --git a/windows/taskmng.h b/windows/taskmng.h old mode 100755 new mode 100644 diff --git a/windows/timemng.cpp b/windows/timemng.cpp old mode 100755 new mode 100644 diff --git a/windows/timemng.h b/windows/timemng.h old mode 100755 new mode 100644 diff --git a/windows/winkbd.h b/windows/winkbd.h old mode 100755 new mode 100644 diff --git a/windows/winloc.cpp b/windows/winloc.cpp old mode 100755 new mode 100644 diff --git a/windows/winloc.h b/windows/winloc.h old mode 100755 new mode 100644 diff --git a/windows/x64/makegrph.x64 b/windows/x64/makegrph.x64 old mode 100755 new mode 100644 diff --git a/windows/x64/parts.x64 b/windows/x64/parts.x64 old mode 100755 new mode 100644 diff --git a/windows/x64/pccore.inc b/windows/x64/pccore.inc old mode 100755 new mode 100644 diff --git a/windows/x64/vram.inc b/windows/x64/vram.inc old mode 100755 new mode 100644 diff --git a/windows/x64/vs2019/x64.props b/windows/x64/vs2019/x64.props old mode 100755 new mode 100644 diff --git a/windows/x64/vs2019/x64.targets b/windows/x64/vs2019/x64.targets old mode 100755 new mode 100644 diff --git a/windows/x64/vs2019/x64.xml b/windows/x64/vs2019/x64.xml old mode 100755 new mode 100644 diff --git a/windows/x86/cputype.h b/windows/x86/cputype.h old mode 100755 new mode 100644 diff --git a/windows/x86/cputype.x86 b/windows/x86/cputype.x86 old mode 100755 new mode 100644 diff --git a/windows/x86/makegrph.x86 b/windows/x86/makegrph.x86 old mode 100755 new mode 100644 diff --git a/windows/x86/np2asm.inc b/windows/x86/np2asm.inc old mode 100755 new mode 100644 diff --git a/windows/x86/opngeng.x86 b/windows/x86/opngeng.x86 old mode 100755 new mode 100644 diff --git a/windows/x86/parts.x86 b/windows/x86/parts.x86 old mode 100755 new mode 100644 diff --git a/windows/x86/pccore.inc b/windows/x86/pccore.inc old mode 100755 new mode 100644 diff --git a/windows/x86/vram.inc b/windows/x86/vram.inc old mode 100755 new mode 100644 diff --git a/windows/x86/vs2019/x86.props b/windows/x86/vs2019/x86.props old mode 100755 new mode 100644 diff --git a/windows/x86/vs2019/x86.targets b/windows/x86/vs2019/x86.targets old mode 100755 new mode 100644 diff --git a/windows/x86/vs2019/x86.xml b/windows/x86/vs2019/x86.xml old mode 100755 new mode 100644 diff --git a/x/README.ja b/x/README.ja old mode 100755 new mode 100644 diff --git a/x/ank12.res b/x/ank12.res old mode 100755 new mode 100644 diff --git a/x/cmmidi.c b/x/cmmidi.c old mode 100755 new mode 100644 diff --git a/x/cmmidi.h b/x/cmmidi.h old mode 100755 new mode 100644 diff --git a/x/cmpara.h b/x/cmpara.h old mode 100755 new mode 100644 diff --git a/x/cmserial.c b/x/cmserial.c old mode 100755 new mode 100644 index 303f3763..1b8d3c48 --- a/x/cmserial.c +++ b/x/cmserial.c @@ -278,6 +278,7 @@ print_status(const struct termios *tio) } #endif +static void convert_np2tocm(UINT port, UINT8* param, UINT32* speed) { static const int cmserial_pc98_ch1_speed[] = { 0, 75, 150, 300, 600, 1200, 2400, 4800, 9600 diff --git a/x/cmserial.h b/x/cmserial.h old mode 100755 new mode 100644 diff --git a/x/commng.c b/x/commng.c old mode 100755 new mode 100644 diff --git a/x/commng.h b/x/commng.h old mode 100755 new mode 100644 diff --git a/x/compiler.h b/x/compiler.h old mode 100755 new mode 100644 diff --git a/x/contrib/udev/70-external-fm-sound.rules b/x/contrib/udev/70-external-fm-sound.rules old mode 100755 new mode 100644 diff --git a/x/debug/debugwin.h b/x/debug/debugwin.h old mode 100755 new mode 100644 diff --git a/x/debug/viewer.h b/x/debug/viewer.h old mode 100755 new mode 100644 diff --git a/x/debug/viewmem.c b/x/debug/viewmem.c old mode 100755 new mode 100644 diff --git a/x/debug/viewmem.h b/x/debug/viewmem.h old mode 100755 new mode 100644 diff --git a/x/dosio.c b/x/dosio.c old mode 100755 new mode 100644 diff --git a/x/dosio.h b/x/dosio.h old mode 100755 new mode 100644 diff --git a/x/drawmng.c b/x/drawmng.c old mode 100755 new mode 100644 diff --git a/x/drawmng.h b/x/drawmng.h old mode 100755 new mode 100644 diff --git a/x/ext/c86ctl/c86ctl.h b/x/ext/c86ctl/c86ctl.h old mode 100755 new mode 100644 diff --git a/x/ext/c86ctl/c86ctlc86box.cpp b/x/ext/c86ctl/c86ctlc86box.cpp old mode 100755 new mode 100644 diff --git a/x/ext/c86ctl/c86ctlc86box.h b/x/ext/c86ctl/c86ctlc86box.h old mode 100755 new mode 100644 diff --git a/x/ext/c86ctl/c86ctlgimic.cpp b/x/ext/c86ctl/c86ctlgimic.cpp old mode 100755 new mode 100644 diff --git a/x/ext/c86ctl/c86ctlgimic.h b/x/ext/c86ctl/c86ctlgimic.h old mode 100755 new mode 100644 diff --git a/x/ext/c86ctl/c86ctlif.cpp b/x/ext/c86ctl/c86ctlif.cpp old mode 100755 new mode 100644 diff --git a/x/ext/c86ctl/c86ctlif.h b/x/ext/c86ctl/c86ctlif.h old mode 100755 new mode 100644 diff --git a/x/ext/c86ctl/c86ctlrealchipbase.cpp b/x/ext/c86ctl/c86ctlrealchipbase.cpp old mode 100755 new mode 100644 diff --git a/x/ext/c86ctl/c86ctlrealchipbase.h b/x/ext/c86ctl/c86ctlrealchipbase.h old mode 100755 new mode 100644 diff --git a/x/ext/externalchip.h b/x/ext/externalchip.h old mode 100755 new mode 100644 diff --git a/x/ext/externalchipmanager.cpp b/x/ext/externalchipmanager.cpp old mode 100755 new mode 100644 diff --git a/x/ext/externalchipmanager.h b/x/ext/externalchipmanager.h old mode 100755 new mode 100644 diff --git a/x/ext/externalopl3.cpp b/x/ext/externalopl3.cpp old mode 100755 new mode 100644 diff --git a/x/ext/externalopl3.h b/x/ext/externalopl3.h old mode 100755 new mode 100644 diff --git a/x/ext/externalopm.cpp b/x/ext/externalopm.cpp old mode 100755 new mode 100644 diff --git a/x/ext/externalopm.h b/x/ext/externalopm.h old mode 100755 new mode 100644 diff --git a/x/ext/externalopna.cpp b/x/ext/externalopna.cpp old mode 100755 new mode 100644 diff --git a/x/ext/externalopna.h b/x/ext/externalopna.h old mode 100755 new mode 100644 diff --git a/x/ext/externalpsg.cpp b/x/ext/externalpsg.cpp old mode 100755 new mode 100644 diff --git a/x/ext/externalpsg.h b/x/ext/externalpsg.h old mode 100755 new mode 100644 diff --git a/x/ext/opl3.cpp b/x/ext/opl3.cpp old mode 100755 new mode 100644 diff --git a/x/ext/opna.cpp b/x/ext/opna.cpp old mode 100755 new mode 100644 diff --git a/x/ext/scci/SCCIDefines.h b/x/ext/scci/SCCIDefines.h old mode 100755 new mode 100644 diff --git a/x/ext/scci/scci.h b/x/ext/scci/scci.h old mode 100755 new mode 100644 diff --git a/x/ext/scci/scciif.cpp b/x/ext/scci/scciif.cpp old mode 100755 new mode 100644 diff --git a/x/ext/scci/scciif.h b/x/ext/scci/scciif.h old mode 100755 new mode 100644 diff --git a/x/ext/scci/sccisoundchip.cpp b/x/ext/scci/sccisoundchip.cpp old mode 100755 new mode 100644 diff --git a/x/ext/scci/sccisoundchip.h b/x/ext/scci/sccisoundchip.h old mode 100755 new mode 100644 diff --git a/x/ext/scci/sccisoundinterface.cpp b/x/ext/scci/sccisoundinterface.cpp old mode 100755 new mode 100644 diff --git a/x/ext/scci/sccisoundinterface.h b/x/ext/scci/sccisoundinterface.h old mode 100755 new mode 100644 diff --git a/x/ext/scci/sccisoundinterfacemanager.cpp b/x/ext/scci/sccisoundinterfacemanager.cpp old mode 100755 new mode 100644 diff --git a/x/ext/scci/sccisoundinterfacemanager.h b/x/ext/scci/sccisoundinterfacemanager.h old mode 100755 new mode 100644 diff --git a/x/ext/scci/sccispfmlight.cpp b/x/ext/scci/sccispfmlight.cpp old mode 100755 new mode 100644 diff --git a/x/ext/scci/sccispfmlight.h b/x/ext/scci/sccispfmlight.h old mode 100755 new mode 100644 diff --git a/x/fontmng.c b/x/fontmng.c old mode 100755 new mode 100644 diff --git a/x/fontmng.h b/x/fontmng.h old mode 100755 new mode 100644 diff --git a/x/gtk2/dialog_about.c b/x/gtk2/dialog_about.c old mode 100755 new mode 100644 diff --git a/x/gtk2/dialog_calendar.c b/x/gtk2/dialog_calendar.c old mode 100755 new mode 100644 diff --git a/x/gtk2/dialog_config.c b/x/gtk2/dialog_config.c old mode 100755 new mode 100644 diff --git a/x/gtk2/dialog_hostdrv.c b/x/gtk2/dialog_hostdrv.c old mode 100755 new mode 100644 diff --git a/x/gtk2/dialog_ide.c b/x/gtk2/dialog_ide.c old mode 100755 new mode 100644 diff --git a/x/gtk2/dialog_network.c b/x/gtk2/dialog_network.c old mode 100755 new mode 100644 diff --git a/x/gtk2/dialog_newdisk.c b/x/gtk2/dialog_newdisk.c old mode 100755 new mode 100644 diff --git a/x/gtk2/dialog_pci.c b/x/gtk2/dialog_pci.c old mode 100755 new mode 100644 diff --git a/x/gtk2/dialog_screen.c b/x/gtk2/dialog_screen.c old mode 100755 new mode 100644 diff --git a/x/gtk2/dialog_serial.c b/x/gtk2/dialog_serial.c old mode 100755 new mode 100644 diff --git a/x/gtk2/dialog_sound.c b/x/gtk2/dialog_sound.c old mode 100755 new mode 100644 diff --git a/x/gtk2/dialog_wab.c b/x/gtk2/dialog_wab.c old mode 100755 new mode 100644 diff --git a/x/gtk2/gtk_drawmng.c b/x/gtk2/gtk_drawmng.c old mode 100755 new mode 100644 diff --git a/x/gtk2/gtk_drawmng.h b/x/gtk2/gtk_drawmng.h old mode 100755 new mode 100644 diff --git a/x/gtk2/gtk_font.c b/x/gtk2/gtk_font.c old mode 100755 new mode 100644 diff --git a/x/gtk2/gtk_keyboard.c b/x/gtk2/gtk_keyboard.c old mode 100755 new mode 100644 diff --git a/x/gtk2/gtk_keyboard.h b/x/gtk2/gtk_keyboard.h old mode 100755 new mode 100644 diff --git a/x/gtk2/gtk_main.c b/x/gtk2/gtk_main.c old mode 100755 new mode 100644 diff --git a/x/gtk2/gtk_menu.c b/x/gtk2/gtk_menu.c old mode 100755 new mode 100644 index a0f61e03..97d30e54 --- a/x/gtk2/gtk_menu.c +++ b/x/gtk2/gtk_menu.c @@ -796,6 +796,7 @@ xmenu_toggle_item(MENU_HDL hdl, const char *name, BOOL onoff) } } +static void xmenu_visible_item(MENU_HDL hdl, const char *name, BOOL onoff) { GtkAction *action; diff --git a/x/gtk2/gtk_menu.h b/x/gtk2/gtk_menu.h old mode 100755 new mode 100644 diff --git a/x/gtk2/gtk_mouse.c b/x/gtk2/gtk_mouse.c old mode 100755 new mode 100644 diff --git a/x/gtk2/gtk_screen.c b/x/gtk2/gtk_screen.c old mode 100755 new mode 100644 diff --git a/x/gtk2/gtk_toolkit.h b/x/gtk2/gtk_toolkit.h old mode 100755 new mode 100644 diff --git a/x/gtk2/gtk_wrapper.c b/x/gtk2/gtk_wrapper.c old mode 100755 new mode 100644 diff --git a/x/gtk2/window_keydisp.c b/x/gtk2/window_keydisp.c old mode 100755 new mode 100644 diff --git a/x/gtk2/window_softkbd.c b/x/gtk2/window_softkbd.c old mode 100755 new mode 100644 diff --git a/x/gtk2/xnp2.h b/x/gtk2/xnp2.h old mode 100755 new mode 100644 diff --git a/x/ini.c b/x/ini.c old mode 100755 new mode 100644 diff --git a/x/ini.h b/x/ini.h old mode 100755 new mode 100644 diff --git a/x/joymng.c b/x/joymng.c old mode 100755 new mode 100644 diff --git a/x/joymng.h b/x/joymng.h old mode 100755 new mode 100644 diff --git a/x/kbdmng.c b/x/kbdmng.c old mode 100755 new mode 100644 diff --git a/x/kbdmng.h b/x/kbdmng.h old mode 100755 new mode 100644 diff --git a/x/kdispwin.c b/x/kdispwin.c old mode 100755 new mode 100644 diff --git a/x/kdispwin.h b/x/kdispwin.h old mode 100755 new mode 100644 diff --git a/x/main.c b/x/main.c old mode 100755 new mode 100644 diff --git a/x/misc/guard.h b/x/misc/guard.h old mode 100755 new mode 100644 diff --git a/x/misc/threadbase.cpp b/x/misc/threadbase.cpp old mode 100755 new mode 100644 diff --git a/x/misc/threadbase.h b/x/misc/threadbase.h old mode 100755 new mode 100644 diff --git a/x/misc/tty.cpp b/x/misc/tty.cpp old mode 100755 new mode 100644 diff --git a/x/misc/tty.h b/x/misc/tty.h old mode 100755 new mode 100644 diff --git a/x/misc/usbdev.cpp b/x/misc/usbdev.cpp old mode 100755 new mode 100644 diff --git a/x/misc/usbdev.h b/x/misc/usbdev.h old mode 100755 new mode 100644 diff --git a/x/mousemng.h b/x/mousemng.h old mode 100755 new mode 100644 diff --git a/x/np2.c b/x/np2.c old mode 100755 new mode 100644 diff --git a/x/np2.h b/x/np2.h old mode 100755 new mode 100644 diff --git a/x/oemtext.c b/x/oemtext.c old mode 100755 new mode 100644 diff --git a/x/oemtext.h b/x/oemtext.h old mode 100755 new mode 100644 diff --git a/x/resources/fddseek.wav b/x/resources/fddseek.wav old mode 100755 new mode 100644 diff --git a/x/resources/fddseek1.wav b/x/resources/fddseek1.wav old mode 100755 new mode 100644 diff --git a/x/resources/np2.xbm b/x/resources/np2.xbm old mode 100755 new mode 100644 diff --git a/x/resources/np2.xpm b/x/resources/np2.xpm old mode 100755 new mode 100644 diff --git a/x/resources/relay1.wav b/x/resources/relay1.wav old mode 100755 new mode 100644 diff --git a/x/scrnmng.h b/x/scrnmng.h old mode 100755 new mode 100644 diff --git a/x/skbdwin.c b/x/skbdwin.c old mode 100755 new mode 100644 diff --git a/x/skbdwin.h b/x/skbdwin.h old mode 100755 new mode 100644 diff --git a/x/soundmng.c b/x/soundmng.c old mode 100755 new mode 100644 diff --git a/x/soundmng.h b/x/soundmng.h old mode 100755 new mode 100644 diff --git a/x/sysmng.c b/x/sysmng.c old mode 100755 new mode 100644 diff --git a/x/sysmng.h b/x/sysmng.h old mode 100755 new mode 100644 diff --git a/x/taskmng.c b/x/taskmng.c old mode 100755 new mode 100644 diff --git a/x/taskmng.h b/x/taskmng.h old mode 100755 new mode 100644 diff --git a/x/timemng.c b/x/timemng.c old mode 100755 new mode 100644 diff --git a/x/timemng.h b/x/timemng.h old mode 100755 new mode 100644 diff --git a/x/toolkit.h b/x/toolkit.h old mode 100755 new mode 100644 diff --git a/x/toolwin.h b/x/toolwin.h old mode 100755 new mode 100644 diff --git a/x/trace.c b/x/trace.c old mode 100755 new mode 100644 diff --git a/x/trace.h b/x/trace.h old mode 100755 new mode 100644 diff --git a/x/xnp21kai.jman1 b/x/xnp21kai.jman1 old mode 100755 new mode 100644 diff --git a/x/xnp21kai.man1 b/x/xnp21kai.man1 old mode 100755 new mode 100644 diff --git a/x/xnp2kai.jman1 b/x/xnp2kai.jman1 old mode 100755 new mode 100644 diff --git a/x/xnp2kai.man1 b/x/xnp2kai.man1 old mode 100755 new mode 100644