SETA ST010 Support (Thanks The Dumper!)

This commit is contained in:
pagefault
2003-12-28 22:31:17 +00:00
parent 9916d8e8f8
commit 910ae02506
5 changed files with 249 additions and 3 deletions

View File

@@ -0,0 +1,128 @@
;Copyright (C) 2003 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either
;version 2 of the License, or (at your option) any later
;version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%include "macros.mac"
NEWSYM SetaCmdEnable, dd 0 ; Seta ST010/ST011 command enable register. Maybe also status.
EXTSYM setaramdata
;; EXTSYM ST010DoCommand ; coming soon
;; TODO - should return ROM for > 8000h
NEWSYM setaaccessbankr8
mov ebx,[setaramdata]
and ecx,0fffh
mov al,[ebx+ecx]
xor ebx,ebx
ret
NEWSYM setaaccessbankw8
test ecx,8000h
jnz .nosetenablew8 ; ignore ROM writes
and ecx,0fffh
mov ebx,[setaramdata]
mov [ebx+ecx],al
cmp byte [ebx+021h], 80h
jnz .nosetenablew8
pushad
;; call ST010DoCommand
popad
.nosetenablew8
xor ebx,ebx
ret
;; We ignore the case where it wraps into ROM reads - should never happen
NEWSYM setaaccessbankr16
mov ebx,[setaramdata]
and ecx,0fffh
mov ax,[ebx+ecx]
xor ebx,ebx
ret
NEWSYM setaaccessbankw16
test ecx,8000h
jnz .nosetenablew16 ; ignore ROM writes
cmp ecx,7fffh
jne .noromw16
mov [setaramdata+0fffh],al ; only write ram part in, not rom part
jmp short .nosetenablew16
.noromw16
and ecx,0fffh
mov ebx,[setaramdata]
cmp ecx,0fffh
jne .nowrapw16
mov [ebx+ecx],al
xchg ah,al
mov [ebx],al
jmp short .nosetenablew16
.nowrapw16
mov word [ebx+ecx],ax
cmp byte [ebx+021h], 80h
jnz .nosetenablew16
pushad
;; call ST010DoCommand
popad
.nosetenablew16
xor ebx,ebx
ret
NEWSYM setaaccessbankr8a
xor al,al
cmp ecx,4000h
jae .nosetenabler8a
and ecx, 3
mov al,[SetaCmdEnable+ecx]
.nosetenabler8a
xor ebx,ebx
ret
NEWSYM setaaccessbankw8a
cmp ecx,4000h
jae .nosetenablew8a
and ecx, 03h
mov [SetaCmdEnable+ecx],al
.nosetenablew8a
xor ebx,ebx
ret
NEWSYM setaaccessbankr16a
xor ax,ax
cmp ecx,4000h
jae .nosetenabler16a
and ecx,3
mov al,[SetaCmdEnable+ecx]
xchg ah,al
inc ecx
and ecx,3
mov al,[SetaCmdEnable+ecx]
.nosetenabler16a
xor ebx,ebx
ret
NEWSYM setaaccessbankw16a
cmp ecx,4000h
jae .nosetenablew16a
mov ebx,[setaramdata]
and ecx,3
mov [ebx+ecx],al
xchg ah,al
inc ecx
and ecx,3
mov [ebx+ecx],al
.nosetenablew16a
xor ebx,ebx
ret

View File

@@ -50,7 +50,7 @@ EXTSYM nextmenupopup
EXTSYM MovieProcessing EXTSYM MovieProcessing
EXTSYM MovieFileHand, PrintStr EXTSYM MovieFileHand, PrintStr
EXTSYM OSExit,DosExit,InitDir,InitDrive,createnewcfg,fnames,gotoroot,previdmode EXTSYM OSExit,DosExit,InitDir,InitDrive,createnewcfg,fnames,gotoroot,previdmode
EXTSYM ramsize,sfxramdata,sram,SRAMDrive,SRAMDir,welcome EXTSYM ramsize,sfxramdata,setaramdata,SETAEnable,sram,SRAMDrive,SRAMDir,welcome
; EXTSYM tempstore ; EXTSYM tempstore
EXTSYM printhex EXTSYM printhex
%ifdef __MSDOS__ %ifdef __MSDOS__
@@ -599,6 +599,11 @@ NEWSYM BackupCVFrame
BackupCVMacB prevoamptr,1 BackupCVMacB prevoamptr,1
BackupCVMac ReadHead,1 BackupCVMac ReadHead,1
cmp byte[SETAEnable],1
jne .noseta
BackupCVMacM [setaramdata],256
.noseta
mov edx,[sram] mov edx,[sram]
mov ecx,[ramsize] mov ecx,[ramsize]
shr ecx,4 shr ecx,4
@@ -694,6 +699,11 @@ NEWSYM RestoreCVFrame
BackupCVRMacB prevoamptr,1 BackupCVRMacB prevoamptr,1
BackupCVRMac ReadHead,1 BackupCVRMac ReadHead,1
cmp byte[SETAEnable],1
jne .noseta
BackupCVRMacM [setaramdata],256
.noseta
mov edx,[sram] mov edx,[sram]
mov ecx,[ramsize] mov ecx,[ramsize]
shr ecx,4 shr ecx,4
@@ -1393,6 +1403,19 @@ NEWSYM endprog
call Write_File call Write_File
call Close_File call Close_File
.nosfxsram .nosfxsram
cmp byte[SETAEnable],0
je .nosetasram
mov edx,fnames+1
call Create_File
jc .nosetasram
mov bx,ax
mov ecx,4096
mov edx,[setaramdata]
call Write_File
call Close_File
.nosetasram
cmp byte[SA1Enable],1 cmp byte[SA1Enable],1
jne .nosa1 jne .nosa1
mov edx,fnames+1 mov edx,fnames+1
@@ -1654,6 +1677,14 @@ NEWSYM statesaver
mov ecx,[SfxRAMMem] mov ecx,[SfxRAMMem]
add [SfxLastRamAdr],ecx add [SfxLastRamAdr],ecx
.nosfx .nosfx
cmp byte[SETAEnable],1
jne .noseta
mov ecx,4096
mov edx,[setaramdata]
call Write_File
.noseta
cmp byte[SPC7110Enable],1 cmp byte[SPC7110Enable],1
jne .nospc7110 jne .nospc7110
mov edx,[romdata] mov edx,[romdata]
@@ -1686,6 +1717,7 @@ NEWSYM statesaver
mov edx,PrevPicture mov edx,PrevPicture
call Write_File call Write_File
.nocapturepicture .nocapturepicture
call Close_File call Close_File
add dword[Curtableaddr],tableA add dword[Curtableaddr],tableA
add dword[spcPCRam],spcRam add dword[spcPCRam],spcRam
@@ -1852,6 +1884,15 @@ NEWSYM stateloader
.nosfx .nosfx
cmp byte[SETAEnable],1
jne near .noseta
mov ecx,4096
add dword[Totalbyteloaded],ecx
mov edx,[setaramdata]
call Read_File
; TODO: load the SetaCmdEnable? For completeness we should do it but currently we ignore it anyway.
.noseta
cmp byte[C4Enable],1 cmp byte[C4Enable],1
jne .noc4 jne .noc4
mov ecx,2000h mov ecx,2000h
@@ -1889,6 +1930,7 @@ NEWSYM stateloader
jne .nosdd1 jne .nosdd1
call UpdateBanksSDD1 call UpdateBanksSDD1
.nosdd1 .nosdd1
call Close_File call Close_File
call repackfunct call repackfunct
mov dword[spcnumread],0 mov dword[spcnumread],0

View File

@@ -77,7 +77,7 @@ EXTSYM Voice0Status, Voice1Status, Voice2Status, Voice3Status, Voice4Status
EXTSYM Voice5Status, Voice6Status, Voice7Status, romtype, SetIRQVectors EXTSYM Voice5Status, Voice6Status, Voice7Status, romtype, SetIRQVectors
EXTSYM ClearScreen, statesaver, loadstate2, vidbuffer, ASCII2Font, hirestiledat EXTSYM ClearScreen, statesaver, loadstate2, vidbuffer, ASCII2Font, hirestiledat
EXTSYM showallext, ROMTypeNOTFound, scanlines,statefileloc,pl1selk,pl2selk EXTSYM showallext, ROMTypeNOTFound, scanlines,statefileloc,pl1selk,pl2selk
EXTSYM fnamest,sprlefttot,spritetablea,fnames,SFXSRAM,sfxramdata,cgram,srama EXTSYM fnamest,sprlefttot,spritetablea,fnames,SFXSRAM,sfxramdata,setaramdata,SETAEnable,cgram,srama
EXTSYM tempco0,prevbright,maxbr,prevpal,coladdr,coladdg,coladdb EXTSYM tempco0,prevbright,maxbr,prevpal,coladdr,coladdg,coladdb
EXTSYM scaddtype,ScreenScale,vesa2red10,initvideo2,initvideo,pressed,UpdateDevices EXTSYM scaddtype,ScreenScale,vesa2red10,initvideo2,initvideo,pressed,UpdateDevices
EXTSYM memtabler8,memtablew8,writeon,pl1contrl,pl2contrl,JoyRead,SetInputDevice EXTSYM memtabler8,memtablew8,writeon,pl1contrl,pl2contrl,JoyRead,SetInputDevice
@@ -800,6 +800,18 @@ clearsram:
dec ecx dec ecx
jnz .loop2 jnz .loop2
.nosfxsram .nosfxsram
cmp byte[SETAEnable],0
je .nosetasram
mov eax,[setaramdata]
mov ecx,4096
.loop2seta
mov byte[eax],0FFh
inc eax
dec ecx
jnz .loop2seta
.nosetasram
cmp byte[SA1Enable],1 cmp byte[SA1Enable],1
jne .nosa1 jne .nosa1
mov eax,[SA1RAMArea] mov eax,[SA1RAMArea]
@@ -1769,6 +1781,22 @@ NEWSYM StartGUI
.nosfxramwrite .nosfxramwrite
stim stim
.nosfxsram .nosfxsram
cmp byte[SETAEnable],0
je .nosetasram
clim
mov edx,fnames+1
call Create_File
jc .nosetaramwrite
mov bx,ax
mov ecx,4096
mov edx,[setaramdata]
call Write_File
call Close_File
.nosetaramwrite
stim
.nosetasram
call GUIQuickLoadUpdate call GUIQuickLoadUpdate
call LoadDetermine call LoadDetermine
; change dir to LoadDrive/LoadDir ; change dir to LoadDrive/LoadDir

View File

@@ -123,6 +123,10 @@ EXTSYM CalcChecksum
EXTSYM BankCheck EXTSYM BankCheck
EXTSYM MirrorROM EXTSYM MirrorROM
EXTSYM SetaCmdEnable,setaramdata
EXTSYM setaaccessbankr8,setaaccessbankw8,setaaccessbankr8a,setaaccessbankw8a
EXTSYM setaaccessbankr16,setaaccessbankw16,setaaccessbankr16a,setaaccessbankw16a
%ifdef __LINUX__ %ifdef __LINUX__
EXTSYM LoadDir, popdir, pushdir EXTSYM LoadDir, popdir, pushdir
%endif %endif
@@ -4487,7 +4491,7 @@ NEWSYM CheckROMType
cmp ax,0F630h cmp ax,0F630h
jne .notSETAB jne .notSETAB
mov byte[SETAEnable],1 mov byte[SETAEnable],1
mov byte[CHIPSRAM],1 ;Check later if this should be removed ;; mov byte[CHIPSRAM],1 ;Check later if this should be removed
jmp .endchpdtct jmp .endchpdtct
.notSETAB .notSETAB
;Super FX has SRAM, but only a battery to save it on the latter two ;Super FX has SRAM, but only a battery to save it on the latter two
@@ -4738,6 +4742,48 @@ NEWSYM CheckROMType
.nosramsfx .nosramsfx
call InitFxTables call InitFxTables
.nosfx .nosfx
;Setup Seta ST010 / ST011 stuff
cmp byte[SETAEnable],1
jne near .noseta
; Really banks 68h-6Fh:0000-7FFF are all mapped the same by the chip but F1ROCII only uses bank 68h
mov dword[memtabler8+68h*4],setaaccessbankr8
mov dword[memtablew8+68h*4],setaaccessbankw8
mov dword[memtabler16+68h*4],setaaccessbankr16
mov dword[memtablew16+68h*4],setaaccessbankw16
; Control register (and some status?) is in banks 60h-67h:0000-3FFF
mov dword[memtabler8+60h*4],setaaccessbankr8a
mov dword[memtablew8+60h*4],setaaccessbankw8a
mov dword[memtabler16+60h*4],setaaccessbankr16a
mov dword[memtablew16+60h*4],setaaccessbankw16a
mov dword[SetaCmdEnable],00000080h ; 60:0000
mov esi,[setaramdata]
mov ecx,1024 ; 4096 bytes
.loopsetaclear
mov dword[esi],0
add esi,4
dec ecx
jnz .loopsetaclear
cmp byte[SramExists],0
je .nosramseta
mov esi,[sram]
mov edi,[setaramdata]
mov ecx,1024
.setasramloop
mov eax,[esi]
mov [edi],eax
add esi,4
add edi,4
dec ecx
jnz .setasramloop
.nosramseta
.noseta
;General Stuff all mixed together ;General Stuff all mixed together
mov dword[SfxSFR],0 mov dword[SfxSFR],0

View File

@@ -192,6 +192,7 @@ NEWSYM vidbufferofsmos, resd 1 ; mosaic offset for new graphics engine
NEWSYM headdata, resd 1 NEWSYM headdata, resd 1
NEWSYM romdata, resd 1 ; rom data (4MB = 4194304) NEWSYM romdata, resd 1 ; rom data (4MB = 4194304)
NEWSYM sfxramdata, resd 1 ; SuperFX Ram Data NEWSYM sfxramdata, resd 1 ; SuperFX Ram Data
NEWSYM setaramdata, resd 1 ; Seta ST010/ST011 SRam Data
NEWSYM wramdata, resd 1 ; stack (64K = 32768) NEWSYM wramdata, resd 1 ; stack (64K = 32768)
NEWSYM ram7f, resd 1 ; ram @ 7f = 65536 NEWSYM ram7f, resd 1 ; ram @ 7f = 65536
NEWSYM vram, resd 1 ; vram = 65536 NEWSYM vram, resd 1 ; vram = 65536
@@ -724,6 +725,7 @@ NEWSYM allocptr
add eax,4194304 add eax,4194304
mov dword[sfxramdata],eax mov dword[sfxramdata],eax
mov dword[setaramdata],eax ; share ram data with sfx
mov esi,[romdata] mov esi,[romdata]
cmp byte[Sup48mbit],0 cmp byte[Sup48mbit],0
je .no48mbit je .no48mbit