SetupROM port and some cleanup.

This commit is contained in:
grinvader
2005-04-07 16:53:45 +00:00
parent 2da78e1866
commit c2af9fb265
12 changed files with 380 additions and 392 deletions

View File

@@ -18,7 +18,7 @@
;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; Sorry. The GUI code is a total mess. One problem I encountered is that
; there seems to be a bug in nasm with using math calculations combined
; with macros within macros, so in some macro definitions, I had to
@@ -63,23 +63,23 @@
; ButtonProcess - routines that processes boxed buttons
; CheatCodeSearchInit
; guiwincontrol
%include "macros.mac"
EXTSYM curblank, vidpastecopyscr, frameskip, newengen, vsyncon
EXTSYM cvidmode, antienab, smallscreenon, smallscreence,NetQuit
EXTSYM soundon, StereoSound, SoundQuality, MusicRelVol
EXTSYM endprog, continueprog, spcBuffera, spcRamcmp, cbitmode, makepal
EXTSYM t1cc, LoadDir, LoadDrive, SRAMDir, SRAMChdir, SRAMDirCurDir, initsnes, romloadskip
EXTSYM fname, makeextension, sram, loadfileGUI, GUIloadfailed
EXTSYM SetupROM, romdata, ForcePal, ramsize, ramsizeand, curromsize
EXTSYM romispal, totlines, cfgloadsdir, init65816, procexecloop
EXTSYM spcRam, spcPCRam, spcS, spcRamDP, spcA, spcX, spcY, spcP, spcNZ
EXTSYM Voice0Status, Voice1Status, Voice2Status, Voice3Status, Voice4Status
EXTSYM Voice5Status, Voice6Status, Voice7Status, romtype, SetIRQVectors
EXTSYM ClearScreen, statesaver, loadstate2, vidbuffer, ASCII2Font, hirestiledat
EXTSYM showallext, ROMTypeNOTFound, scanlines,statefileloc,pl1selk,pl2selk
EXTSYM curblank,vidpastecopyscr,frameskip,newengen,vsyncon
EXTSYM cvidmode,antienab, smallscreenon, smallscreence,NetQuit
EXTSYM soundon,StereoSound,SoundQuality,MusicRelVol
EXTSYM endprog,continueprog,spcBuffera,spcRamcmp,cbitmode,makepal
EXTSYM t1cc,LoadDir,LoadDrive,SRAMDir,SRAMChdir,SRAMDirCurDir,initsnes
EXTSYM fname,makeextension,sram,loadfileGUI,GUIloadfailed,romloadskip
EXTSYM SetupROM,romdata,ForcePal,ramsize,ramsizeand,curromsize
EXTSYM romispal,totlines,cfgloadsdir,init65816,procexecloop
EXTSYM spcRam,spcPCRam,spcS,spcRamDP,spcA,spcX,spcY,spcP,spcNZ
EXTSYM Voice0Status,Voice1Status,Voice2Status,Voice3Status,Voice4Status
EXTSYM Voice5Status,Voice6Status,Voice7Status,romtype
EXTSYM ClearScreen,statesaver,loadstate2,vidbuffer,ASCII2Font,hirestiledat
EXTSYM showallext,ROMTypeNOTFound,scanlines,statefileloc,pl1selk,pl2selk
EXTSYM fnamest,sprlefttot,spritetablea,fnames,CHIPBATT,sfxramdata,setaramdata,SETAEnable,cgram,srama
EXTSYM tempco0,prevbright,maxbr,prevpal,coladdr,coladdg,coladdb
EXTSYM scaddtype,ScreenScale,vesa2red10,initvideo2,initvideo,pressed,UpdateDevices
@@ -148,7 +148,7 @@ EXTSYM outofmemfix,yesoutofmemory
EXTSYM JoyX,JoyY,JoyMinX,JoyMinY,JoyMaxX,JoyMaxY,JoyMinX209,JoyMaxX209
EXTSYM JoyMinY209,JoyMaxY209,GetCoords,GetCoords3
EXTSYM MultiTap,SFXEnable
EXTSYM RestoreSystemVars
EXTSYM RestoreSystemVars
EXTSYM TCPIPStartServer
EXTSYM TCPIPInitConnectToServer
EXTSYM TCPIPWaitForConnection
@@ -234,7 +234,7 @@ NEWSYM WaterOn, db 1
; Video
; Sound
; Paths
; Saves
; Saves
; MultiPlay only has "Internet" for Windows/Linux
@@ -386,10 +386,10 @@ GUIloadfntype db 0
NEWSYM pl3selk, dd 0 ; 3SELECT = SHIFT
NEWSYM pl3startk, dd 0 ; 3START = ENTER
NEWSYM pl3upk, dd 0 ; 3UP = up
NEWSYM pl3downk, dd 0 ; 3DOWN = down
NEWSYM pl3leftk, dd 0 ; 3LEFT = left
NEWSYM pl3rightk, dd 0 ; 3RIGHT = right
NEWSYM pl3upk, dd 0 ; 3UP = up
NEWSYM pl3downk, dd 0 ; 3DOWN = down
NEWSYM pl3leftk, dd 0 ; 3LEFT = left
NEWSYM pl3rightk, dd 0 ; 3RIGHT = right
NEWSYM pl3Xk, dd 0 ; 3X = INS
NEWSYM pl3Ak, dd 0 ; 3A = HOME
NEWSYM pl3Lk, dd 0 ; 3L = PAGE UP
@@ -398,10 +398,10 @@ NEWSYM pl3Bk, dd 0 ; 3B = END
NEWSYM pl3Rk, dd 0 ; 3R = PAGE DOWN
NEWSYM pl4selk, dd 0 ; 4SELECT = SHIFT
NEWSYM pl4startk, dd 0 ; 4START = ENTER
NEWSYM pl4upk, dd 0 ; 4UP = up
NEWSYM pl4downk, dd 0 ; 4DOWN = down
NEWSYM pl4leftk, dd 0 ; 4LEFT = left
NEWSYM pl4rightk, dd 0 ; 4RIGHT = right
NEWSYM pl4upk, dd 0 ; 4UP = up
NEWSYM pl4downk, dd 0 ; 4DOWN = down
NEWSYM pl4leftk, dd 0 ; 4LEFT = left
NEWSYM pl4rightk, dd 0 ; 4RIGHT = right
NEWSYM pl4Xk, dd 0 ; 4X = INS
NEWSYM pl4Ak, dd 0 ; 4A = HOME
NEWSYM pl4Lk, dd 0 ; 4L = PAGE UP
@@ -544,10 +544,10 @@ NEWSYM GUIEffect, db 0
NEWSYM pl5selk, dd 0 ; 4SELECT = SHIFT
NEWSYM pl5startk, dd 0 ; 4START = ENTER
NEWSYM pl5upk, dd 0 ; 4UP = up
NEWSYM pl5downk, dd 0 ; 4DOWN = down
NEWSYM pl5leftk, dd 0 ; 4LEFT = left
NEWSYM pl5rightk, dd 0 ; 4RIGHT = right
NEWSYM pl5upk, dd 0 ; 4UP = up
NEWSYM pl5downk, dd 0 ; 4DOWN = down
NEWSYM pl5leftk, dd 0 ; 4LEFT = left
NEWSYM pl5rightk, dd 0 ; 4RIGHT = right
NEWSYM pl5Xk, dd 0 ; 4X = INS
NEWSYM pl5Ak, dd 0 ; 4A = HOME
NEWSYM pl5Lk, dd 0 ; 4L = PAGE UP
@@ -851,7 +851,7 @@ clearsram:
dec ecx
jnz .loop2
.nosfxbatt
cmp byte[SETAEnable],0
je .nosetasram
mov eax,[setaramdata]
@@ -866,7 +866,7 @@ clearsram:
cmp byte[SA1Enable],1
jne .nosa1
cmp byte[CHIPBATT],1
jne .nosa1
jne .nosa1
mov eax,[SA1RAMArea]
mov ecx,65536*2
.loop3
@@ -1496,26 +1496,26 @@ NEWSYM SaveSramData
je .savesramdone
mov edx,[sram]
cmp byte[SFXEnable],1
cmp byte[SFXEnable],1
jne .notsfx
mov edx,[sfxramdata]
.notsfx
.notsfx
cmp byte[SA1Enable],1
jne .notsa1
mov edx,[SA1RAMArea]
.notsa1
.notsa1
cmp byte[SETAEnable],1
jne .notseta
mov edx,[setaramdata]
.notseta
cmp edx,[sram]
cmp edx,[sram]
je .notspecial
cmp byte[CHIPBATT],0
je .savesramdone
.notspecial
clim
push edx ;Backup data to save
mov edx,fnames+1
call Create_File
@@ -1527,11 +1527,11 @@ NEWSYM SaveSramData
call Write_File
call Close_File
push edx ;Dirty hack for the next line
.failed
.failed
pop edx ;This is needed here because if the jump to failed is carried out, edx is never popped
stim
.savesramdone
call SaveCombFile
; change dir to InitDrive/InitDir
@@ -1852,7 +1852,7 @@ NEWSYM StartGUI
call GUIQuickLoadUpdate
call LoadDetermine
; change dir to LoadDrive/LoadDir
mov dl,[LoadDrive]
mov ebx,LoadDir
@@ -2357,8 +2357,8 @@ NEWSYM StartGUI
mov dword[PBackupPos],0
call RestoreCVFrame
popad
mov esi,[tempesi]
mov edi,[tempedi]
mov esi,[tempesi]
mov edi,[tempedi]
mov ebp,[tempebp]
.norestoreval
@@ -2861,8 +2861,8 @@ guipostvideo:
cmp dword[GUIkeydelay],0
je .pressedokay
mov byte[pressed+39h],0
mov byte[pressed+39h],0
call JoyRead
cmp byte[pressed+39h],0
jne .pressedokay
@@ -3415,10 +3415,10 @@ DisplayBoxes:
jmp .finstuff
.noguichosesave
cmp al,3
jne .noguiinput
call DisplayGUIInput
jne .noguiinput
call DisplayGUIInput
jmp .finstuff
.noguiinput
.noguiinput
cmp al,4
jne .noguioption
call DisplayGUIOption
@@ -3598,9 +3598,9 @@ GUIProcReset:
jne .nomovierecording
call ResetDuringMovie
jmp .movieendif
.nomovierecording
.nomovierecording
call GUIDoReset
.movieendif
.movieendif
popad
cmp byte[CNetType],20
jne .noreset
@@ -3940,7 +3940,9 @@ InitGUI:
call GetScreen
.nong16b
call ClearScreen
pushad
call Clear2xSaIBuffer
popad
call GUISetPal
call GUIBufferData
ret
@@ -5408,7 +5410,7 @@ GUIIconDataCheckBoxUC:
GUIIconDataCheckBoxC:
db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,165,0
db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,165,0 ,0
db 0 ,0 ,0 ,0 ,0 ,0 ,0 ,165,0 ,0
db 0 ,0 ,0 ,0 ,0 ,0 ,165,0 ,0 ,0
db 0 ,220,219,218,217,165,215,0 ,0 ,0
db 0 ,165,165,217,165,165,214,202,0 ,0

View File

@@ -915,11 +915,11 @@ GUIOptionKeys:
cmp dh,'P'
jne .noautopatch
xor byte[AutoPatch],1
.noautopatch
.noautopatch
cmp dh,'T'
jne .norominfo
xor byte[RomInfo],1
.norominfo
.norominfo
%ifdef __WIN32__
cmp dh,'I'
jne .noscreensaver
@@ -927,7 +927,7 @@ GUIOptionKeys:
.noscreensaver
%endif
ret
GUISaveKeys:
cmp dh,'a'
jb .nocap
@@ -1071,12 +1071,16 @@ GUIGUIOptnsKeys:
cmp byte[En2xSaI],1
jnae .guioptn15
call ClearScreen
pushad
call Clear2xSaIBuffer
popad
.guioptn15
cmp byte[hqFilter],0
je .guioptn16
call ClearScreen
pushad
call Clear2xSaIBuffer
popad
.guioptn16
ret
@@ -1105,7 +1109,7 @@ GUIVideoKeys:
jmp .refresh
.nomodeq
cmp byte[cvidmode],5
jne .nofullscanlines
jne .nofullscanlines
.refresh
mov byte[cbitmode],1
call initvideo2
@@ -1177,7 +1181,9 @@ GUIVideoKeys:
mov bl,[cvidmode]
cmp byte[GUI2xVID+ebx],0
je near .no2xsai
pushad
call Clear2xSaIBuffer
popad
GUIkeystoggleoptn byte[En2xSaI],1
.no2xsai
cmp dh,'E'
@@ -1186,7 +1192,9 @@ GUIVideoKeys:
mov bl,[cvidmode]
cmp byte[GUI2xVID+ebx],0
je near .nosupereagle
pushad
call Clear2xSaIBuffer
popad
GUIkeystoggleoptn byte[En2xSaI],2
.nosupereagle
cmp dh,'S'
@@ -1195,7 +1203,9 @@ GUIVideoKeys:
mov bl,[cvidmode]
cmp byte[GUI2xVID+ebx],0
je near .nosuper2xsai
pushad
call Clear2xSaIBuffer
popad
GUIkeystoggleoptn byte[En2xSaI],3
.nosuper2xsai
cmp dh,'I'
@@ -1371,7 +1381,7 @@ GUIVideoKeys:
cmp dl,72
jne .noup
%endif
.up
.up
cmp dword[GUIcurrentvideocursloc],0
je .noup
mov ebx,[GUIcurrentvideocursloc]
@@ -1754,7 +1764,7 @@ GUIPathKeys:
jmp .findend
.foundend
cmp dh,8 ;Backspace
cmp dh,8 ;Backspace
jne .notbackspace
cmp eax,ecx
je .cantback
@@ -1762,7 +1772,7 @@ GUIPathKeys:
.cantback
ret
.notbackspace
cmp dh,13 ;Enter
jne .notenter
mov dword[GUIInputBox],0

View File

@@ -273,7 +273,7 @@ GUIloadfilename:
mov dword[nmiprevline],224
mov dword[nmistatus],0
mov dword[spcnumread],0
mov dword[spchalted],-1
mov dword[spchalted],-1
mov byte[NextLineCache],0
mov byte[curexecstate],1
@@ -293,8 +293,8 @@ GUIloadfilename:
mov byte[CheatWinMode],0
mov byte[CheatSearchStatus],0
call SetupROM
pushad
call SetupROM
call showinfogui
popad
call initsnes

View File

@@ -128,7 +128,7 @@ SetAllKeys:
mov edi,pl5selk
mov dword[keycontrolval],pl5contrl
.nopl5
;Check if controller is set
push eax
mov eax,dword[keycontrolval]
@@ -136,7 +136,7 @@ SetAllKeys:
pop eax
jne .noLockInputChange
ret
.noLockInputChange
.noLockInputChange
mov dword[guicpressptr],edi
xor ebx,ebx
mov ecx,12
@@ -361,7 +361,9 @@ SetDevice:
NEWSYM GUIDoReset
call ClearScreen
pushad
call Clear2xSaIBuffer
popad
; mov byte[NetPlayNoMore],1
mov byte[RestoreValues],0

View File

@@ -1411,7 +1411,9 @@ GUIWinClicked:
cmp edx,%2+8
jg %%noclick
xor %3,1
pushad
call Clear2xSaIBuffer
popad
%%noclick
%endmacro
@@ -2119,7 +2121,7 @@ DisplayGUIMovieClick:
GUIPButtonHole 100,40,byte[CMovieExt],'7'
GUIPButtonHole 120,40,byte[CMovieExt],'8'
GUIPButtonHole 140,40,byte[CMovieExt],'9'
DGOptnsProcBox 116,68,[KeyInsrtChap]
DGOptnsProcBox 116,84,[KeyNextChap]
DGOptnsProcBox 116,100,[KeyPrevChap]
@@ -2244,7 +2246,7 @@ DisplayGUIInputClick:
mov edi,pl5selk
mov dword[keycontrolval],pl5contrl
.nopl5
;Check if controller is set
push eax
mov eax,dword[keycontrolval]
@@ -3333,9 +3335,9 @@ DisplayGUISaveClick:
GUIPHoldbutton2 173,32,181,40,72,byte[RewindFrames],1,40
GUIPHoldbutton2 184,32,192,40,73,byte[RewindFrames],-1,0
DGOptnsProcBox 27,121,[KeyStateSlc0]
DGOptnsProcBox 27+45,121,[KeyStateSlc1]
DGOptnsProcBox 27+45,121,[KeyStateSlc1]
DGOptnsProcBox 27+45*2,121,[KeyStateSlc2]
DGOptnsProcBox 27+45*3,121,[KeyStateSlc3]
DGOptnsProcBox 27+45*3,121,[KeyStateSlc3]
DGOptnsProcBox 27,130,[KeyStateSlc4]
DGOptnsProcBox 27+45,130,[KeyStateSlc5]
DGOptnsProcBox 27+45*2,130,[KeyStateSlc6]

View File

@@ -30,7 +30,7 @@ EXTSYM spcon,vesa2_bpos,vesa2_clbit,vesa2_gpos,vesa2_rpos,vesa2selec
EXTSYM vidbuffer,spritetablea,sprlefttot,newengen,spcextraram,resolutn
EXTSYM Open_File,Close_File,Read_File,Write_File,Create_File,Get_Key,Get_Date
EXTSYM continueprognokeys,ForceNonTransp,GUIOn,Check_Key,JoyRead
EXTSYM GetScreen,SSKeyPressed,SPCKeyPressed,StopSound,StartSound
EXTSYM GetScreen,SSKeyPressed,SPCKeyPressed,StopSound,StartSound
EXTSYM ExecExitOkay,t1cc
EXTSYM Clear2xSaIBuffer
EXTSYM romdata,romtype,ScreenShotFormat
@@ -213,7 +213,7 @@ NEWSYM showmenu
.nomenuinc3
mov dword[menudrawbox8b.stringi+13],' BMP'
%ifndef NO_PNG
%ifndef NO_PNG
cmp byte[ScreenShotFormat],0
je .normalscrn
mov dword[menudrawbox8b.stringi+13],' PNG'
@@ -484,7 +484,9 @@ NEWSYM showmenu
call StartSound
mov byte[ForceNonTransp],0
mov byte[GUIOn],0
pushad
call Clear2xSaIBuffer
popad
cmp byte[MenuNoExit],1
je .noexitmenu
jmp continueprognokeys
@@ -1172,7 +1174,7 @@ NEWSYM savepcx
ret
.notpng
%endif
mov byte[pressed+1],0
mov byte[pressed+59],0
cmp byte[cbitmode],1