Updated interleave detection code and added detection for ST018 chip

This commit is contained in:
pagefault
2003-05-08 21:34:23 +00:00
parent 87dcdf5e63
commit 9896c4442f

View File

@@ -5315,12 +5315,16 @@ NEWSYM showinfogui
.nosdd1 .nosdd1
cmp byte[OBCEnable],0 cmp byte[OBCEnable],0
je .noobc je .noobc
mov dword[CSStatus+25],'OBC ' mov dword[CSStatus+25],'OBC1'
.noobc .noobc
cmp byte[SETAEnable],0 cmp byte[SETAEnable],0
je .noseta je .noseta
mov dword[CSStatus+25],'SETA' mov dword[CSStatus+25],'SETA'
.noseta .noseta
cmp byte[ST18Enable],0
je .nost18
mov dword[CSStatus+25],'ST18'
.nost18
cmp byte[SGBEnable],0 cmp byte[SGBEnable],0
je .nosgb je .nosgb
mov dword[CSStatus+25],'SGB ' mov dword[CSStatus+25],'SGB '
@@ -5990,64 +5994,38 @@ NEWSYM CheckROMType
mov byte[ROMTypeNOTFound],0 mov byte[ROMTypeNOTFound],0
.noforce .noforce
xor eax,eax ;LoROM interleaved check
xor ebx,ebx mov esi,[romdata]
xor edx,edx add esi,07FDCh ;Checksum area
mov bx,[esi]
xor bx,[esi + 2]
cmp bx,0FFFFh ;Good LoROM?
je .interlcheck2 ;Forget it then
mov eax,[NumofBanks] mov eax,[NumofBanks]
imul eax,32768 imul eax,32768
shr eax,1 shr eax,1
mov esi,[romdata] add esi,eax ;Add midpoint
add esi,7FC0h mov bx,[esi]
add esi,eax xor bx,[esi + 2]
add esi,28
mov ebx,[esi]
inc esi
mov edx,[esi]
shl edx,16
add ebx,edx
inc esi
add ebx,[esi]
inc esi
mov edx,[esi]
shl edx,16
add ebx,edx
cmp bx,0FFFFh cmp bx,0FFFFh
jne .interlcheck2 jne .interlcheck2
mov esi,[romdata] sub esi,3 ;Country code
add esi,7FC0h
add esi,eax
add esi,25
cmp byte[esi],14 cmp byte[esi],14
jae .interlcheck2 jae .interlcheck2
jmp .interleaved jmp .interleaved
;HiROM interleaved check
.interlcheck2 .interlcheck2
xor ebx,ebx
xor edx,edx
mov esi,[romdata] mov esi,[romdata]
add esi,7FC0h add esi,07FDCh ;Checksum area
add esi,28 mov bx,[esi]
mov ebx,[esi] xor bx,[esi + 2]
inc esi
mov edx,[esi]
shl edx,16
add ebx,edx
inc esi
add ebx,[esi]
inc esi
mov edx,[esi]
shl edx,16
add ebx,edx
cmp bx,0FFFFh cmp bx,0FFFFh
jne near .nointerlcheck jne near .nointerlcheck
mov esi,[romdata] sub esi,3 ;Country code
add esi,7FC0h
add esi,25
cmp byte[esi],14 cmp byte[esi],14
jae .nointerlcheck jae .nointerlcheck
mov esi,[romdata] sub esi,4 ;ROM makeup
add esi,7FC0h
add esi,21
cmp byte[esi],33 cmp byte[esi],33
je .overflowcheck je .overflowcheck
cmp byte[esi],49 cmp byte[esi],49
@@ -6145,6 +6123,7 @@ NEWSYM CheckROMType
mov byte[CHIPSRAM],0 mov byte[CHIPSRAM],0
mov byte[SGBEnable],0 mov byte[SGBEnable],0
mov byte[SETAEnable],0 mov byte[SETAEnable],0
mov byte[ST18Enable],0
mov byte[DSP1Enable],0 mov byte[DSP1Enable],0
mov byte[DSP2Enable],0 mov byte[DSP2Enable],0
mov byte[DSP3Enable],0 mov byte[DSP3Enable],0
@@ -6208,13 +6187,14 @@ NEWSYM CheckROMType
.notSA1B .notSA1B
cmp ax,0F530h cmp ax,0F530h
jne .notSETAA jne .notSETAA
mov byte[SETAEnable],1 mov byte[ST18Enable],1
mov byte[CHIPSRAM],1 mov byte[CHIPSRAM],1 ;Check later if this should be removed
jmp .endchpdtct jmp .endchpdtct
.notSETAA .notSETAA
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
jmp .endchpdtct jmp .endchpdtct
.notSETAB .notSETAB
cmp ax,01320h cmp ax,01320h
@@ -6413,7 +6393,8 @@ NEWSYM RTCEnable, resb 1
NEWSYM SA1Enable, resb 1 NEWSYM SA1Enable, resb 1
NEWSYM SDD1Enable, resb 1 NEWSYM SDD1Enable, resb 1
NEWSYM OBCEnable, resb 1 NEWSYM OBCEnable, resb 1
NEWSYM SETAEnable, resb 1 NEWSYM SETAEnable, resb 1 ;ST010 & 11
NEWSYM ST18Enable, resb 1
NEWSYM SGBEnable, resb 1 NEWSYM SGBEnable, resb 1
NEWSYM DSP1Enable, resb 1 NEWSYM DSP1Enable, resb 1
NEWSYM DSP2Enable, resb 1 NEWSYM DSP2Enable, resb 1