Ports global variables to C (Aerdan, grinvader), restores bilinear behaviour, eats some unused stuff.

This commit is contained in:
grinvader
2005-02-03 00:53:19 +00:00
parent e485530b2b
commit 22537a6749
6 changed files with 120 additions and 126 deletions

View File

@@ -5633,7 +5633,7 @@ DisplayGUIAbout:
ret
SECTION .data
GUIGUIAboutText1 db 'ZSNES V',ZVERSION,' ',0 ;Need room for date
GUIGUIAboutText1 db 'ZSNES ',ZVERSION,' ',0 ;Need room for date
GUIGUIAboutText2 db 'CODED BY : ',0
GUIGUIAboutText3 db ' ZSKNIGHT _DEMO_',0
GUIGUIAboutText4 db ' PAGEFAULT NACH',0

View File

@@ -46,7 +46,7 @@ extern DWORD BitDepth;
static unsigned short *glvidbuffer = 0;
static GLuint gltextures[4];
static int gltexture256, gltexture512;
static int glfilters = GL_LINEAR;
static int glfilters = GL_NEAREST;
static int glscanready = 0;
extern Uint8 En2xSaI, scanlines;
extern Uint8 BilinearFilter;

View File

@@ -23,7 +23,7 @@ bits 32
section .text
; Zsnes required macros
%define ZVERSION 'Pre 1.43'
%define ZVERSION 'Pre 1.43' ; Don't forget to put the 'v' here now
%ifdef ELF
%imacro newsym 1

View File

@@ -38,6 +38,12 @@ EXTSYM cfgloadgdir,cfgloadsdir
EXTSYM init18_2hz
EXTSYM OSExit,GUIOn2
EXTSYM SRAMDirCurDir,SRAMChdir,SRAMChdirFail
EXTSYM frameskip,BitConv32Ptr,spcBuffera,spritetablea,vcache2bs
EXTSYM vcache4bs,vcache8bs,RGBtoYUVPtr,newgfx16b,vidbuffer,vidbufferofsa
EXTSYM vidbufferofsmos,ngwinptr,vidbufferofsb,headdata,romdata,sfxramdata
EXTSYM setaramdata,wramdata,ram7f,vram,sram,debugbuf,regptr,regptw,vcache2b
EXTSYM vcache4b,vcache8b,fname,fnames,fnamest,filefound,vidbufferofsc,DSPDisable
EXTSYM gammalevel,gammalevel16b,Sup48mbit,Sup16mbit,guioff
%ifdef __LINUX__
EXTSYM LinuxExit
@@ -135,126 +141,21 @@ NEWSYM mydebug, db '',13,10,0
NEWSYM outofmem, db 'You don',39,'t have enough memory to run this program!',13,10,0
NEWSYM welcome
db 'ZSNES v',ZVERSION,' (c) 1997-2005, ZSNES Team',13,10,13,10
db 'Be sure to check http://www.zsnes.com/ for the latest version.',13,10
db 'Please report crashes to zsnes-devel@lists.sourceforge.net.',13,10,13,10
db 'ZSNES is written by the ZSNES Team (See AUTHORS.TXT)',13,10
db 'ZSNES comes with ABSOLUTELY NO WARRANTY. This is free software,',10,13
db 'and you are welcome to redistribute it under certain conditions;',10,13
%ifdef __LINUX__
db 'please read ',39,'LICENSE',39,' thoroughly before doing so.',10,13,10,13
%else
db 'please read ',39,'LICENSE.TXT',39,' thoroughly before doing so.',10,13,10,13
%endif
db 'Use ZSNES -? for command line definitions.',13,10,13,10,0
db 'ZSNES v',ZVERSION,' (c) 1997-2005, ZSNES Team',13,10,13,10
db 'Be sure to check http://www.zsnes.com/ for the latest version.',13,10
db 'Please report crashes to zsnes-devel@lists.sourceforge.net.',13,10,13,10
db 'ZSNES is written by the ZSNES Team (See AUTHORS.TXT)',13,10
db 'ZSNES comes with ABSOLUTELY NO WARRANTY. This is free software,',10,13
db 'and you are welcome to redistribute it under certain conditions;',10,13
db 'please read ',39,'LICENSE.TXT',39,' thoroughly before doing so.',10,13,10,13
db 'Use ZSNES -? for command line definitions.',13,10,13,10,0
;cpuidfname db 'nocpuzid.dat',0
;cpuidtext db 'NOTE: If ZSNES crashes here, then please re-run. ',0
;cpuidtext2 db 13,' ',13,0
YesMMX db 'MMX support found and enabled.',13,10,13,10,0
; global variables
NEWSYM per2exec, dd 100 ; percentage of opcodes to execute
%ifdef __MSDOS__
NEWSYM cvidmode, db 4 ; video mode, 0=320x240, 1=256x256
%else
NEWSYM cvidmode, db 1 ; video mode, 0=320x240, 1=256x256
%endif
section .bss
NEWSYM string, resb 512
NEWSYM fname, resb 512
NEWSYM fnames, resb 512 ; sram filename
NEWSYM fnamest, resb 512 ; state filename
NEWSYM prevvid, resd 1
NEWSYM selc0040, resd 1
NEWSYM selcA000, resd 1
NEWSYM selcB800, resd 1
NEWSYM filefound, resd 1 ; Parameter String Found
NEWSYM prevdash, resd 1 ; Previous Dash Value
NEWSYM frameskip, resd 1 ; 0 = Auto, 1-10 = Skip 0 .. 9
NEWSYM vidbuffer, resd 1 ; video buffer (1024x239 = 244736)
NEWSYM ngwinptr, resd 1
NEWSYM vidbufferm, resd 1 ; video buffer mirror
NEWSYM vidbufferofsa, resd 1 ; offset 1
NEWSYM vidbufferofsb, resd 1 ; offset 2
NEWSYM vidbufferofsc, resd 1 ; offset 2
NEWSYM vidbufferofsmos, resd 1 ; mosaic offset for new graphics engine
NEWSYM headdata, resd 1
NEWSYM romdata, resd 1 ; rom data (4MB = 4194304)
NEWSYM sfxramdata, resd 1 ; SuperFX Ram Data
NEWSYM setaramdata, resd 1 ; Seta ST010/ST011 SRam Data
NEWSYM wramdata, resd 1 ; stack (64K = 32768)
NEWSYM ram7f, resd 1 ; ram @ 7f = 65536
NEWSYM vram, resd 1 ; vram = 65536
NEWSYM sram, resd 1 ; sram = 32768
NEWSYM spritetablea, resd 1 ;
NEWSYM spcBuffera, resd 1 ;
NEWSYM debugbuf, resd 1 ; debug buffer = 38x1000 = 38000
NEWSYM regptr, resd 1 ; pointer to registers
NEWSYM regptw, resd 1 ; pointer to registers
NEWSYM vcache2b, resd 1 ; 2-bit video cache
NEWSYM vcache4b, resd 1 ; 4-bit video cache
NEWSYM vcache8b, resd 1 ; 8-bit video cache
NEWSYM vcache2bs, resd 1 ; 2-bit video secondary cache
NEWSYM vcache4bs, resd 1 ; 4-bit video secondary cache
NEWSYM vcache8bs, resd 1 ; 8-bit video secondary cache
NEWSYM romispal, resb 1 ; 0 = NTSC, 1 = PAL
NEWSYM enterpress, resb 1 ; if enter is to be issued (0 = yes)
NEWSYM newgfx16b, resb 1
NEWSYM BitConv32Ptr, resd 1
NEWSYM RGBtoYUVPtr, resd 1
NEWSYM previdmode, resb 1 ; previous video mode
NEWSYM cbitmode, resb 1 ; bit mode, 0=8bit, 1=16bit
SECTION .data
NEWSYM opexec268, db 168 ; # of opcodes/scanline in 2.68Mhz mode
NEWSYM opexec358, db 180 ; # of opcodes/scanline in 3.58Mhz mode (228/180)
NEWSYM opexec268cph, db 42 ; # of opcodes/hblank in 2.68Mhz mode
NEWSYM opexec358cph, db 45 ; # of opcodes/hblank in 3.58Mhz mode (56/50)
NEWSYM opexec268b, db 168 ; # of opcodes/scanline in 2.68Mhz mode
NEWSYM opexec358b, db 180 ; # of opcodes/scanline in 3.58Mhz mode (228/180)
NEWSYM opexec268cphb, db 42 ; # of opcodes/hblank in 2.68Mhz mode
NEWSYM opexec358cphb, db 45 ; # of opcodes/hblank in 3.58Mhz mode (56/50)
NEWSYM debugdisble, db 1 ; debugger disable. 0 = no, 1 = yes
NEWSYM gammalevel, db 0 ; gamma level
NEWSYM gammalevel16b, db 0 ; gamma level
NEWSYM scanlines, db 0 ; scanlines on/off
NEWSYM vsyncon, db 0 ; vsync on/off
NEWSYM guioff, db 0 ; gui off (1)
NEWSYM AddSub256, db 0 ; screen add/sub in 256 colors
NEWSYM Sup48mbit, db 1 ; Support 48mbit roms
NEWSYM Sup16mbit, db 0 ; Support 16mbit roms
NEWSYM dmadeddis, db 0 ; DMA deduction
NEWSYM antienab, db 0 ; Interpolation Enabled
NEWSYM snesmouse, db 0 ; Mouse enabled (=1)
NEWSYM OldStyle, db 1 ; Old style joystick on
NEWSYM SecondPort, db 0 ; Secondary Joystick Port Enabled (209h)
NEWSYM YesMMX, db 'MMX support found and enabled.',13,10,13,10,0
; New Variables
NEWSYM ForcePal, db 0 ; 1 = NTSC, 2 = PAL
NEWSYM Force8b, db 0 ; Force 8-bit sound on
NEWSYM Doublevbuf, db 1 ; Double video buffer
NEWSYM V8Mode, db 0 ; Vegetable mode! =)
NEWSYM fastmemptr, db 0
NEWSYM showallext, db 0
NEWSYM finterleave, db 0
NEWSYM DSPDisable, db 0
NEWSYM Palette0, db 0
NEWSYM DisplayS, db 0
NEWSYM SPC700sh, db 0
NEWSYM OffBy1Line, db 0
NEWSYM spc7110romptr, dd 0
NEWSYM MusicRelVol, db 75
NEWSYM MusicVol, db 0
;NEWSYM BetaUser, db 37,38,210,56,78,23,7,7,0
SECTION .text

View File

@@ -30,21 +30,114 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define false 0
extern void outofmemory();
extern unsigned char *spc7110romptr;
extern unsigned char *spcBuffera;
extern unsigned char *spritetablea;
extern unsigned char *vbufaptr;
extern unsigned char *vbufeptr;
extern unsigned char *ngwinptrb;
extern unsigned char *vbufdptr;
extern unsigned char *vcache2bs;
extern unsigned char *vcache4bs;
extern unsigned char *vcache8bs;
extern unsigned char *RGBtoYUVPtr;
extern unsigned char *romaptr;
extern unsigned char welcome[452+16]; // 452=message string, 16=version string
extern unsigned char mydebug[2];
extern unsigned char outofmem[51];
extern unsigned char YesMMX[34];
// Global Variables ported from ASM
void *doMemAlloc(int size)
unsigned int per2exec = 100; // percentage of opcodes to execute
#ifdef __MSDOS__
unsigned char cvidmode = 4; // video mode
#else
unsigned char cvidmode = 1;
#endif
unsigned char string[512];
unsigned char fname[512];
unsigned char fnames[512]; // sram filename
unsigned char fnamest[512]; // state filename
unsigned short selc0040;
unsigned short selcA000;
unsigned short selcB800;
unsigned char filefound; // Parameter String Found
unsigned char frameskip; // 0 = Auto, 1-10 = Skip 0 .. 9
unsigned char *vidbuffer; // video buffer (1024x239 = 244736)
unsigned char *ngwinptr;
unsigned char *vidbufferm; // video buffer mirror
unsigned char *vidbufferofsa; // offset 1
unsigned char *vidbufferofsb; // offset 2
unsigned char *vidbufferofsc; // offset 3
unsigned char *vidbufferofsmos; // mosaic offset for new graphics engine
unsigned char *headdata;
unsigned char *romdata; // rom data (4MB = 4194304)
unsigned char *sfxramdata; // SuperFX Ram Data
unsigned char *setaramdata; // Seta ST010/ST011 SRam Data
unsigned char *wramdata; // stack (64K = 32768)
unsigned char *ram7f; // ram @ 7f = 65536
unsigned char *vram; // vram = 65536
unsigned char *sram; // sram = 32768
unsigned char *spritetablea;
unsigned char *spcBuffera;
unsigned char *debugbuf; // debug buffer = 38x1000 = 38000
void (**regptr)(); // pointer to registers
void (**regptw)(); // pointer to registers
unsigned char *vcache2b; // 2-bit video cache
unsigned char *vcache4b; // 4-bit video cache
unsigned char *vcache8b; // 8-bit video cache
unsigned char *vcache2bs; // 2-bit video secondary cache
unsigned char *vcache4bs; // 4-bit video secondary cache
unsigned char *vcache8bs; // 8-bit video secondary cache
unsigned char romispal; // 0 = NTSC, 1 = PAL
unsigned char enterpress; // if enter is to be issued (0 = yes)
unsigned char newgfx16b;
unsigned char *BitConv32Ptr;
unsigned char *RGBtoYUVPtr;
unsigned char previdmode; // previous video mode
unsigned char cbitmode; // bit mode, 0=8bit, 1=16bit
unsigned char opexec268 = 168; // # of opcodes/scanline in 2.68Mhz mode
unsigned char opexec358 = 180; // # of opcodes/scanline in 3.58Mhz mode (228/180)
unsigned char opexec268cph = 42; // # of opcodes/hblank in 2.68Mhz mode
unsigned char opexec358cph = 45; // # of opcodes/hblank in 3.58Mhz mode (56/50)
unsigned char opexec268b = 168; // # of opcodes/scanline in 2.68Mhz mode
unsigned char opexec358b = 180; // # of opcodes/scanline in 3.58Mhz mode (228/180)
unsigned char opexec268cphb = 42; // # of opcodes/hblank in 2.68Mhz mode
unsigned char opexec358cphb = 45; // # of opcodes/hblank in 3.58Mhz mode (56/50)
unsigned char debugdisble = 1; // debugger disable. 0 = no, 1 = yes
unsigned char gammalevel = 0; // gamma level
unsigned char gammalevel16b = 0; // gamma level
unsigned char scanlines = 0; // scanlines on/off
unsigned char vsyncon = 0; // vsync on/off
unsigned char guioff = 0; // gui on/off (1 = off)
unsigned char AddSub256 = 0; // screen add/sub in 256 colors
unsigned char Sup48mbit = 1; // Support 48mbit roms
unsigned char Sup16mbit = 0; // Support 16mbit roms
unsigned char dmadeddis = 0; // DMA deduction
unsigned char antienab = 0; // Interpolation Enabled
unsigned char snesmouse = 0; // Mouse status (1 = enabled)
unsigned char OldStyle = 1; // Old style joystick on
unsigned char SecondPort = 0; // Secondary Joystick Port Enabled (209h)
// New Variables
unsigned char ForcePal = 0; // 1 = NTSC, 2 = PAL
unsigned char Force8b = 0; // Force 8-bit sound on
unsigned char Doublevbuf = 1; // Double video buffer
unsigned char V8Mode = 0; // Vegetable mode! =)
unsigned char fastmemptr = 0;
unsigned char showallext = 0;
unsigned char finterleave = 0;
unsigned char DSPDisable = 0;
unsigned char Palette0 = 0;
unsigned char DisplayS = 0;
unsigned char SPC700sh = 0;
unsigned char OffBy1Line = 0;
unsigned char *spc7110romptr;
unsigned char MusicRelVol = 75;
unsigned char MusicVol = 0;
void *doMemAlloc(size_t size)
{
void *ptr = NULL;
ptr = malloc(size);

View File

@@ -28,7 +28,7 @@ EXTSYM newengen,nextframe,objptr,pressed,prevpal,res512switch,res640
EXTSYM resolutn,romispal,scaddtype,scadtng,scanlines
EXTSYM scbcong,selcA000,snesmouse,t1cc,vcache4b,vesa2_bpos,spritetablea
EXTSYM vesa2_clbit,vesa2_gpos,vesa2_rpos,vesa2red10,vesa2selec,vidbuffer
EXTSYM vidbufferm,vram,vsyncon,vbufdptr,KeyStateSelct,forceblnk,soundon
EXTSYM vram,vsyncon,vbufdptr,KeyStateSelct,forceblnk,soundon
EXTSYM Open_File,Read_File,Close_File,Create_File,Write_File,Get_File_Date
EXTSYM Triplebufen,makepal,changepal,saveselectpal,displayfpspal,superscopepal
EXTSYM DrawScreen,MMXSupport