📄 tm94.bas
字号:
Attribute VB_Name = "tm94"
Option Explicit
'Global SHandle As Long
'Global state_buffer() As Byte
'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 writetm94(ptemp As String)
Dim ta1 As Byte
Dim ta2 As Byte
Dim es As Byte
Dim temp(11) As Byte
Dim stemp(11) As Byte
Dim flag As Integer
Dim i As Integer
Dim recs As String
For i = 0 To 11
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), &H4) >= 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, &HF)
flag = TMTouchByte(SHandle, &H0)
flag = TMTouchByte(SHandle, &H0)
For i = 0 To 6
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, &HAA)
ta1 = TMTouchByte(SHandle, &HFF)
ta2 = TMTouchByte(SHandle, &HFF)
es = TMTouchByte(SHandle, &HFF)
For i = 0 To 6
stemp(i) = TMTouchByte(SHandle, &HFF)
Next i
For i = 0 To 6
If temp(i) <> stemp(i) Then
writetm94 = False
SHandle = TMEndSession(SHandle)
Exit Function
End If
Next i
If TMTouchReset(SHandle) = 1 Then
If (TMSetup(SHandle) = 1) Then
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &H55)
flag = TMTouchByte(SHandle, ta1)
flag = TMTouchByte(SHandle, ta2)
flag = TMTouchByte(SHandle, es)
If TMTouchReset(SHandle) = 1 Then
If (TMSetup(SHandle) = 1) Then
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &HF)
flag = TMTouchByte(SHandle, &H3)
flag = TMTouchByte(SHandle, &H2)
For i = 7 To 10
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, &HAA)
ta1 = TMTouchByte(SHandle, &HFF)
ta2 = TMTouchByte(SHandle, &HFF)
es = TMTouchByte(SHandle, &HFF)
If TMTouchReset(SHandle) = 1 Then
If (TMSetup(SHandle) = 1) Then
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &H55)
flag = TMTouchByte(SHandle, ta1)
flag = TMTouchByte(SHandle, ta2)
flag = TMTouchByte(SHandle, es)
If TMTouchReset(SHandle) = 1 Then
TMEndSession (SHandle)
writetm94 = True
End If
End If
End If
End If
End If
End If
End If
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
End If
End If
If TMTouchReset(SHandle) = 1 Then
SHandle = TMEndSession(SHandle)
writetm94 = False
End If
End Function
Public Function readtm94()
Dim temp(7) As Byte
Dim flag As Integer
Dim i As Integer
Dim recs As String
Dim ctr As Byte
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), &H4) >= 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, &HF0)
flag = TMTouchByte(SHandle, &H1)
flag = TMTouchByte(SHandle, &H2)
For i = 0 To 5
temp(i) = TMTouchByte(SHandle, &HFF)
Next i
recs = ""
For i = 5 To 2 Step -1
If (temp(i) <= 15) Then
recs = recs + "0" + Hex(temp(i))
Else
recs = recs + Hex(temp(i))
End If
Next i
If TMTouchReset(SHandle) = 1 Then
If (TMSetup(SHandle) = 1) Then
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &HF0)
flag = TMTouchByte(SHandle, &H0)
flag = TMTouchByte(SHandle, &H0)
For i = 0 To 6
temp(i) = TMTouchByte(SHandle, &HFF)
Next i
For i = 0 To 6
If (temp(i) <= 15) Then
recs = recs + "0" + Hex(temp(i))
Else
recs = recs + Hex(temp(i))
End If
Next i
End If
End If
End If
TMEndSession (SHandle)
readtm94 = recs
Exit Function
End If
End If
End If
End If
End If
End If
If TMTouchReset(SHandle) = 1 Then
SHandle = TMEndSession(SHandle)
readtm94 = ""
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -