📄 tm91.bas
字号:
Attribute VB_Name = "tm91"
Option Explicit
Global SHandle As Long
Global state_buffer() As Byte
Global PortNum As Integer
Global PortType As Integer
Global Debounce(100) As Integer
Global SelectROM(8) As Integer
Global SelectFile(6) As Byte
Global DirBuf(256) As Byte
Global SaveEditData As String
Global SetupDone As Integer
Global MaxDbnc As Integer
Declare Function RegOpenKeyExA Lib "Advapi32.DLL" (ByVal hKey As Long, ByVal lpszSubKey As String, ByVal dwReserved As Long, ByVal samDesired As Long, phkResult As Long) As Long
Declare Function RegQueryValueExA Lib "Advapi32.DLL" (ByVal hKey As Long, ByVal lpszValueName As String, ByVal lpdwReserved As Any, lpdwType As Long, lpbData As Byte, lpcbData As Long) As Long
Declare Function RegCloseKey Lib "Advapi32.DLL" (ByVal hKey As Long) As Long
Public Const KEY_READ As Long = &H120019
Public Const HKEY_LOCAL_MACHINE As Long = &H80000002
Public Const ERROR_SUCCESS As Long = &H0
Public Const REG_SZ As Long = &H1
Public Function writesub1(ptemp As String)
Dim subid(8) As Byte
Dim temp(64) As Byte
Dim flag As Integer
Dim i As Integer
Dim recs As String
For i = 0 To 63
temp(i) = Val("&H" + Mid(ptemp, 2 * i + 1, 2))
Next i
For i = 1 To 4
PortNum = i
PortType = 5
SHandle = TMExtendedStartSession(PortNum, PortType, vbNullString)
If TMSetup(SHandle) = 1 Then
'Err.Raise
Exit For
End If
Next i
If (SHandle > 0) Then
If (TMSetup(SHandle) = 1) Then
If (TMSetup(SHandle) = 1) Then
If TMFamilySearchSetup(SHandle, state_buffer(0), &H2) >= 1 Then
If (TMNext(SHandle, state_buffer(0)) = 1) Then
flag = TMRom(SHandle, state_buffer(0), SelectROM(0))
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &H5A)
flag = TMTouchByte(SHandle, &H0)
flag = TMTouchByte(SHandle, &HFF)
For i = 0 To 7
subid(i) = TMTouchByte(SHandle, &HFF)
Next i
For i = 0 To 7
flag = TMTouchByte(SHandle, subid(i))
Next i
For i = 0 To 7
flag = TMTouchByte(SHandle, temp(i))
Next i
For i = 8 To 15
flag = TMTouchByte(SHandle, temp(i))
Next i
If TMTouchReset(SHandle) = 1 Then
If (TMSetup(SHandle) = 1) Then
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &H96)
flag = TMTouchByte(SHandle, &HC0)
flag = TMTouchByte(SHandle, &H3F)
For i = 0 To 63
flag = TMTouchByte(SHandle, temp(i))
Next i
If TMTouchReset(SHandle) = 1 Then
If (TMSetup(SHandle) = 1) Then
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &H3C)
flag = TMTouchByte(SHandle, &H0)
flag = TMTouchByte(SHandle, &HFF)
flag = TMTouchByte(SHandle, &H56)
flag = TMTouchByte(SHandle, &H56)
flag = TMTouchByte(SHandle, &H7F)
flag = TMTouchByte(SHandle, &H51)
flag = TMTouchByte(SHandle, &H57)
flag = TMTouchByte(SHandle, &H5D)
flag = TMTouchByte(SHandle, &H5A)
flag = TMTouchByte(SHandle, &H7F)
For i = 8 To 15
flag = TMTouchByte(SHandle, temp(i))
Next i
If TMTouchReset(SHandle) = 1 Then
TMEndSession (SHandle)
writesub1 = True
Exit Function
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If TMTouchReset(SHandle) = 1 Then
SHandle = TMEndSession(SHandle)
writesub1 = False
End If
End Function
Public Function writesub2(ptemp As String)
Dim subid(8) As Byte
Dim temp(64) As Byte
Dim flag As Integer
Dim i As Integer
Dim recs As String
For i = 0 To 63
temp(i) = Val("&H" + Mid(ptemp, 2 * i + 1, 2))
Next i
For i = 1 To 4
PortNum = i
PortType = 5
SHandle = TMExtendedStartSession(PortNum, PortType, vbNullString)
If SHandle > 0 Then
Exit For
End If
Next i
If (SHandle > 0) Then
If (TMSetup(SHandle) = 1) Then
If (TMSetup(SHandle) = 1) Then
If TMFamilySearchSetup(SHandle, state_buffer(0), &H2) >= 1 Then
If (TMNext(SHandle, state_buffer(0)) = 1) Then
flag = TMRom(SHandle, state_buffer(0), SelectROM(0))
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &H5A)
flag = TMTouchByte(SHandle, &H40)
flag = TMTouchByte(SHandle, &HBF)
For i = 0 To 7
subid(i) = TMTouchByte(SHandle, &HFF)
Next i
For i = 0 To 7
flag = TMTouchByte(SHandle, subid(i))
Next i
For i = 0 To 7
flag = TMTouchByte(SHandle, temp(i))
Next i
For i = 8 To 15
flag = TMTouchByte(SHandle, temp(i))
Next i
If TMTouchReset(SHandle) = 1 Then
If (TMSetup(SHandle) = 1) Then
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &H96)
flag = TMTouchByte(SHandle, &HC0)
flag = TMTouchByte(SHandle, &H3F)
For i = 0 To 63
flag = TMTouchByte(SHandle, temp(i))
Next i
If TMTouchReset(SHandle) = 1 Then
If (TMSetup(SHandle) = 1) Then
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &H3C)
flag = TMTouchByte(SHandle, &H40)
flag = TMTouchByte(SHandle, &HBF)
flag = TMTouchByte(SHandle, &H56)
flag = TMTouchByte(SHandle, &H56)
flag = TMTouchByte(SHandle, &H7F)
flag = TMTouchByte(SHandle, &H51)
flag = TMTouchByte(SHandle, &H57)
flag = TMTouchByte(SHandle, &H5D)
flag = TMTouchByte(SHandle, &H5A)
flag = TMTouchByte(SHandle, &H7F)
For i = 8 To 15
flag = TMTouchByte(SHandle, temp(i))
Next i
If TMTouchReset(SHandle) = 1 Then
TMEndSession (SHandle)
writesub2 = True
Exit Function
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If TMTouchReset(SHandle) = 1 Then
SHandle = TMEndSession(SHandle)
writesub2 = False
End If
End Function
Public Function writesub3(ptemp As String)
Dim subid(8) As Byte
Dim temp(64) As Byte
Dim flag As Integer
Dim i As Integer
Dim recs As String
For i = 0 To 63
temp(i) = Val("&H" + Mid(ptemp, 2 * i + 1, 2))
Next i
For i = 1 To 4
PortNum = i
PortType = 5
SHandle = TMExtendedStartSession(PortNum, PortType, vbNullString)
If SHandle > 0 Then
Exit For
End If
Next i
If (SHandle > 0) Then
If (TMSetup(SHandle) = 1) Then
If (TMSetup(SHandle) = 1) Then
If TMFamilySearchSetup(SHandle, state_buffer(0), &H2) >= 1 Then
If (TMNext(SHandle, state_buffer(0)) = 1) Then
flag = TMRom(SHandle, state_buffer(0), SelectROM(0))
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &H5A)
flag = TMTouchByte(SHandle, &H80)
flag = TMTouchByte(SHandle, &H7F)
For i = 0 To 7
subid(i) = TMTouchByte(SHandle, &HFF)
Next i
For i = 0 To 7
flag = TMTouchByte(SHandle, subid(i))
Next i
For i = 0 To 7
flag = TMTouchByte(SHandle, temp(i))
Next i
For i = 8 To 15
flag = TMTouchByte(SHandle, temp(i))
Next i
If TMTouchReset(SHandle) = 1 Then
If (TMSetup(SHandle) = 1) Then
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &H96)
flag = TMTouchByte(SHandle, &HC0)
flag = TMTouchByte(SHandle, &H3F)
For i = 0 To 63
flag = TMTouchByte(SHandle, temp(i))
Next i
If TMTouchReset(SHandle) = 1 Then
If (TMSetup(SHandle) = 1) Then
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &H3C)
flag = TMTouchByte(SHandle, &H80)
flag = TMTouchByte(SHandle, &H7F)
flag = TMTouchByte(SHandle, &H56)
flag = TMTouchByte(SHandle, &H56)
flag = TMTouchByte(SHandle, &H7F)
flag = TMTouchByte(SHandle, &H51)
flag = TMTouchByte(SHandle, &H57)
flag = TMTouchByte(SHandle, &H5D)
flag = TMTouchByte(SHandle, &H5A)
flag = TMTouchByte(SHandle, &H7F)
For i = 8 To 15
flag = TMTouchByte(SHandle, temp(i))
Next i
If TMTouchReset(SHandle) = 1 Then
TMEndSession (SHandle)
writesub3 = True
Exit Function
End If
End If
End If
End If
End If
End If
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -