mirror of
https://github.com/BertoldVdb/ms-tools.git
synced 2025-12-10 07:44:46 +01:00
Update MS213x after testing
This commit is contained in:
parent
8f41e7db4e
commit
967bb582c2
8 changed files with 59 additions and 5 deletions
|
|
@ -2,4 +2,6 @@ as31 -Fbin init.asm
|
|||
as31 -Fbin hook.asm
|
||||
as31 -Fbin finishf660.asm
|
||||
as31 -Fbin finishsig.asm
|
||||
as31 -Fbin vsync.asm
|
||||
as31 -Fbin readinfo.asm
|
||||
as31 -Fbin readinfo2.asm
|
||||
|
|
|
|||
|
|
@ -16,11 +16,12 @@ MOVX A, @DPTR
|
|||
MOV R5, A
|
||||
|
||||
; Signal info
|
||||
INC DPTR
|
||||
MOV DPTR, #0xf6e9
|
||||
MOVX A, @DPTR
|
||||
MOV R6, A
|
||||
|
||||
; Frame counter
|
||||
MOV R6, 0x29
|
||||
MOV R7, 0x28
|
||||
MOV DPTR, #0x7b16
|
||||
MOVX A, @DPTR
|
||||
|
||||
RET
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<EFBFBD>{את£א<C2A3>£א<C2A3>£א£א®)¯("
|
||||
<EFBFBD>{את£א<C2A3>£א<C2A3>£א<EFBFBD>ציא<EFBFBD>{א"
|
||||
27
ms213x_patch/asm/readinfo2.asm
Normal file
27
ms213x_patch/asm/readinfo2.asm
Normal 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
|
||||
1
ms213x_patch/asm/readinfo2.bin
Normal file
1
ms213x_patch/asm/readinfo2.bin
Normal file
|
|
@ -0,0 +1 @@
|
|||
<EFBFBD>ב„את£א<EFBFBD><EFBFBD>ב<EFBFBD>א<EFBFBD>£א<EFBFBD>ציא<EFBFBD>{א"
|
||||
7
ms213x_patch/asm/vsync.asm
Normal file
7
ms213x_patch/asm/vsync.asm
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
MOV DPTR, #0x7b16
|
||||
MOVX A, @DPTR
|
||||
INC A
|
||||
MOVX @DPTR, A
|
||||
|
||||
MOV DPTR, #0xf055
|
||||
RET
|
||||
1
ms213x_patch/asm/vsync.bin
Normal file
1
ms213x_patch/asm/vsync.bin
Normal file
|
|
@ -0,0 +1 @@
|
|||
<EFBFBD>{àð<>ðU"
|
||||
|
|
@ -28,9 +28,15 @@ var patchFinishf660 []byte
|
|||
//go:embed asm/finishsig.bin
|
||||
var patchFinishSig []byte
|
||||
|
||||
//go:embed asm/vsync.bin
|
||||
var patchVSYNC []byte
|
||||
|
||||
//go:embed asm/readinfo.bin
|
||||
var patchReadInfo []byte
|
||||
|
||||
//go:embed asm/readinfo2.bin
|
||||
var patchReadInfo2 []byte
|
||||
|
||||
func (p *patcher) addCode(code []byte) uint16 {
|
||||
offs := len(p.image)
|
||||
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)
|
||||
}
|
||||
|
||||
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) {
|
||||
/* Check if it is a file we know how to handle */
|
||||
hash := sha256.Sum256(in)
|
||||
|
|
@ -115,8 +126,12 @@ func patch(in []byte) ([]byte, error) {
|
|||
/* Write signal info to safe place (0x7b14) */
|
||||
p.replaceJump(0xe9c6, p.addCode(patchFinishSig))
|
||||
|
||||
/* Count frames */
|
||||
p.replaceCall(0xb208, p.addCode(patchVSYNC))
|
||||
|
||||
/* 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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue