Update MS213x after testing

This commit is contained in:
Bertold Van den Bergh 2023-11-05 22:30:28 +01:00
parent 8f41e7db4e
commit 967bb582c2
8 changed files with 59 additions and 5 deletions

View file

@ -2,4 +2,6 @@ as31 -Fbin init.asm
as31 -Fbin hook.asm as31 -Fbin hook.asm
as31 -Fbin finishf660.asm as31 -Fbin finishf660.asm
as31 -Fbin finishsig.asm as31 -Fbin finishsig.asm
as31 -Fbin vsync.asm
as31 -Fbin readinfo.asm as31 -Fbin readinfo.asm
as31 -Fbin readinfo2.asm

View file

@ -16,11 +16,12 @@ MOVX A, @DPTR
MOV R5, A MOV R5, A
; Signal info ; Signal info
INC DPTR MOV DPTR, #0xf6e9
MOVX A, @DPTR MOVX A, @DPTR
MOV R6, A
; Frame counter ; Frame counter
MOV R6, 0x29 MOV DPTR, #0x7b16
MOV R7, 0x28 MOVX A, @DPTR
RET RET

View file

@ -1 +1 @@
<EFBFBD>{את£א<C2A3>£א<C2A3>£א£א®)¯(" <EFBFBD>{את£א<C2A3>£א<C2A3>£א<EFBFBD>ציא<EFBFBD>{א"

View file

@ -0,0 +1,27 @@
; Resolution info
MOV DPTR, #0xe184
MOVX A, @DPTR
MOV R2, A
INC DPTR
MOVX A, @DPTR
MOV R3, A
MOV DPTR, #0xe18c
MOVX A, @DPTR
MOV R4, A
INC DPTR
MOVX A, @DPTR
MOV R5, A
; Signal info
MOV DPTR, #0xf6e9
MOVX A, @DPTR
MOV R6, A
; Frame counter
MOV DPTR, #0x7b16
MOVX A, @DPTR
RET

View file

@ -0,0 +1 @@
<EFBFBD>ב„את£א<EFBFBD><EFBFBD>ב<EFBFBD>א<EFBFBD>£א<EFBFBD>ציא<EFBFBD>{א"

View file

@ -0,0 +1,7 @@
MOV DPTR, #0x7b16
MOVX A, @DPTR
INC A
MOVX @DPTR, A
MOV DPTR, #0xf055
RET

View file

@ -0,0 +1 @@
<EFBFBD>{àð<>ðU"

View file

@ -28,9 +28,15 @@ var patchFinishf660 []byte
//go:embed asm/finishsig.bin //go:embed asm/finishsig.bin
var patchFinishSig []byte var patchFinishSig []byte
//go:embed asm/vsync.bin
var patchVSYNC []byte
//go:embed asm/readinfo.bin //go:embed asm/readinfo.bin
var patchReadInfo []byte var patchReadInfo []byte
//go:embed asm/readinfo2.bin
var patchReadInfo2 []byte
func (p *patcher) addCode(code []byte) uint16 { func (p *patcher) addCode(code []byte) uint16 {
offs := len(p.image) offs := len(p.image)
p.image = append(p.image, code...) p.image = append(p.image, code...)
@ -65,6 +71,11 @@ func (p *patcher) replaceJump(offset, dest uint16) {
binary.BigEndian.PutUint16(p.image[offset+1:], dest) binary.BigEndian.PutUint16(p.image[offset+1:], dest)
} }
func (p *patcher) replaceCall(offset, dest uint16) {
p.image[offset] = 0x12
binary.BigEndian.PutUint16(p.image[offset+1:], dest)
}
func patch(in []byte) ([]byte, error) { func patch(in []byte) ([]byte, error) {
/* Check if it is a file we know how to handle */ /* Check if it is a file we know how to handle */
hash := sha256.Sum256(in) hash := sha256.Sum256(in)
@ -115,8 +126,12 @@ func patch(in []byte) ([]byte, error) {
/* Write signal info to safe place (0x7b14) */ /* Write signal info to safe place (0x7b14) */
p.replaceJump(0xe9c6, p.addCode(patchFinishSig)) p.replaceJump(0xe9c6, p.addCode(patchFinishSig))
/* Count frames */
p.replaceCall(0xb208, p.addCode(patchVSYNC))
/* Finally, add read results function */ /* Finally, add read results function */
log.Printf("ReadInfo Offset: %02x", p.addCode(patchReadInfo)) log.Printf("ReadInfo1 Offset: %02x", p.addCode(patchReadInfo))
log.Printf("ReadInfo2 Offset: %02x", p.addCode(patchReadInfo2))
return p.image, nil return p.image, nil
} }