📄 axd.vbs
字号:
Dim HelperText
Dim FormatList
Dim GenericList, EightBitList, SixteenBitList, ThirtytwoBitList, SixtyfourBitList, EightyBitList, UserDefinedList
Dim DataSize
Dim ListHeader
ListCounter = true
ListFormatPar = SizeOption
'HelperText = "Helper info about this format"
GenericList = "" : EightBitList = "" : SixteenBitList = "" : ThirtytwoBitList = "" : SixtyfourBitList = "" : EightyBitList = "" : UserDefinedList = ""
ListHeader = "Index" & Chr(9) & AddSpace("ShortName", 25) & "RDIName" & Chr(13) & Chr(10)
set FormatList = session.ListFormat(SizeOption)
ListFormatPar = SizeOption
' Set FormatRDINameString = CreateObject("Scripting.Dictionary")
' Set FormatIndexString = CreateObject("Scripting.Dictionary")
count = FormatList.count
iter = 0 : index = 0
do while iter < count
set ThisFormat = FormatList(iter)
DataSize = ThisFormat.GetSize
FmtRDIName = ThisFormat.GetRDIName
FmtName = ThisFormat.GetName
select case DataSize
case 0:
GenericList = GenericList & Chr(35) & CStr(index + 1) & Chr(9) & AddSpace(FmtName, 25) & FmtRDIName & chr(13) & chr(10)
case 8:
EightBitList = EightBitList & Chr(35) & CStr(index + 1) & Chr(9) & AddSpace(FmtName, 25) & FmtRDIName & chr(13) & chr(10)
case 16:
SixteenBitList = SixteenBitList & Chr(35) & CStr(index + 1) & Chr(9) & AddSpace(ThisFormat.GetName, 25) & FmtRDIName & chr(13) & chr(10)
case 32:
ThirtytwoBitList = ThirtytwoBitList & Chr(35) & CStr(index + 1) & Chr(9) & AddSpace(ThisFormat.GetName, 25) & FmtRDIName & chr(13) & chr(10)
case 64:
SixtyfourBitList = SixtyfourBitList & Chr(35) & CStr(index + 1) & Chr(9) & AddSpace(ThisFormat.GetName, 25) & FmtRDIName & chr(13) & chr(10)
case 80:
EightyBitList = EightyBitList & Chr(35) & CStr(index + 1) & Chr(9) & AddSpace(ThisFormat.GetName, 25) & FmtRDIName & chr(13) & chr(10)
case else:
' If DataSize <> 0 Then
UserDefinedList = UserDefinedList & Chr(35) & CStr(index + 1) & Chr(9) & AddSpace(ThisFormat.GetName, 25) & FmtRDIName & chr(13) & chr(10)
' End If
End Select
' If DataSize <> 0 Then
FormatRDINameString = FormatRDINameString & CStr(FmtRDIName) & "%" & CStr(iter) & "%"
RegBankNameString = RegBankNameString & CStr(FmtName) & "%" & CStr(iter) & "%"
'FormatRDINameString.Add Chr(35) & CStr(index + 1), FmtRDIName
'FormatIndexString.Add FmtRDIName, Chr(35) & CStr(index + 1)
index = index + 1
' End If
iter = iter + 1
'might need to generate old list for compatibility..., or take the 0 size off totally.
loop
If SizeOption = -1 Then
ListTitle = "Generic display formats:" & chr(13) & chr(10)
txt = txt & ListTitle & ListHeader & GenericList
ElseIf IsEmpty(GenericList) = True and SizeOption = -1 Then
txt = txt & "Generic display formats:" & chr(13) & chr(10) & "No display format is available for this domain." & chr(13) & chr(10)
End If
If (SizeOption = 8 or SizeOption = -1 ) and IsEmpty(EightBitList) = False Then
ListTitle = "8 bits data display formats:" & chr(13) & chr(10)
txt = txt & ListTitle & ListHeader & EightBitList
ElseIf IsEmpty(EightBitList) = True and SizeOption = 8 Then
txt = txt & "8 bits data display formats:" & chr(13) & chr(10) & "No display format is available for this domain." & chr(13) & chr(10)
End If
If IsEmpty(SixteenBitList) = False and (SizeOption = 16 or SizeOption = -1 ) Then
ListTitle = "16 bits data display formats:" & chr(13) & chr(10)
txt = txt & ListTitle & ListHeader & SixteenBitList
ElseIf IsEmpty(SixteenBitList) = True and SizeOption = 16 Then
txt = txt & "16 bits data display formats:" & chr(13) & chr(10) & "No display format is available for this domain." & chr(13) & chr(10)
End If
If ThirtytwoBitList <> "" and (SizeOption = 32 or SizeOption = -1 ) Then
ListTitle = "32 bits data display formats:" & chr(13) & chr(10)
txt = txt & ListTitle & ListHeader & ThirtytwoBitList
ElseIf ThirtytwoBitList = "" and SizeOption = 32 Then
txt = txt & "32 bits data display formats:" & chr(13) & chr(10) & "No display format is available for this domain." & chr(13) & chr(10)
End If
If SixtyfourBitList <> "" and (SizeOption = 64 or SizeOption = -1 ) Then
ListTitle = "64 bits data display formats:" & chr(13) & chr(10)
txt = txt & ListTitle & ListHeader & SixtyfourBitList
ElseIf SixtyfourBitList = "" and SizeOption = 64 Then
txt = txt & "64 bits data display formats:" & chr(13) & chr(10) & "No display format is available for this domain." & chr(13) & chr(10)
End If
If EightyBitList <> "" and (SizeOption = 80 or SizeOption = -1) Then
ListTitle = "80 bits data display formats:" & chr(13) & chr(10)
txt = txt & ListTitle & ListHeader & EightyBitList
ElseIf EightyBitList = "" and SizeOption = 80 Then
txt = txt & "80 bits data display formats:" & chr(13) & chr(10) & "No display format is available for this domain." & chr(13) & chr(10)
End If
If (SizeOption <> -1 or (SizeOption Mod 8 <> 0 or SizeOption > 80)) and UserDefinedList <> "" Then
If SizeOption = -1 Then
BitName = "Other"
Else
BitName = CStr(SizeOption)
End If
ListTitle = BitName & " bits data display formats:" & chr(13) & chr(10)
txt = txt & ListTitle & ListHeader & UserDefinedList
ElseIf UserDefinedList = "" and (SizeOption Mod 8 <> 0 or SizeOption > 80) Then
txt = txt & BitName & " bits data display formats:" & chr(13) & chr(10) & "No display format is available for this domain." & chr(13) & chr(10)
End If
FormatListText = txt
adw3cli.Display(FormatListText)
End Function
''''''''''''''''''''''''''
' Loadings
''''''''''''''''''''''''''
Function Load(FileName, ProcIndex) '<--- CLI command
On Error Resume Next
Load = LoadInt(FileName, ProcIndex)
DisplayError
End Function
Function LoadInt(FileName, ProcIndex)
Dim loadStatus, index
Dim curProc
set curProc = CheckInitProc(ProcIndex)
loadStatus = session.LoadImage(FileName, curProc.Handle)
ImageLoadFlag = TRUE
End Function
Function ImgProperties(ImageIndex) '<--- CLI command
On Error Resume Next
ImgProperties = ImgPropertiesInt(ImageIndex)
DisplayError
End Function
Function ImgPropertiesInt(ImageIndex)
Dim CurImage, cmdLineText, argText
cmdLineText = "CmdLine:"
set CurImage = CheckForImage(ImageIndex)
argText = CurImage.GetCmdLine
If argText = "" Then
argText = "Command line argument has not been set."
End If
cmdLineText = cmdLineText & Chr(9) & argText & Chr(13) & Chr(10)
adw3cli.Display(cmdLineText)
End Function
Function SetImgProp(ImageIndex, PropType, ArgString)
On Error Resume Next
SetImgProp = SetImgPropInt(ImageIndex, PropType, ArgString)
DisplayError
End Function
Function SetImgPropInt(ImageIndex, PropType, ArgString)
set CurImage = CheckForImage(ImageIndex)
If PropType = "cmdline" Then
CurImage.SetCmdLine(ArgString)
Else
err.raise 1000, "VBScript", "Invalid property parameter."
End If
End Function
Function CheckInitProc(ProcIndex)
dim pindex
pindex = ProcIndex
ProcListText = UpdateProcList
If ProcIndex = -1 Then
set CheckInitProc = GetCurrentProcessor
Else
set CheckInitProc = GetObjFromKey(pindex, ProcList, ProcNameString, ProcIDString, index)
End If
End Function
Function ProcProperties(ProcIndex) '<--- CLI command
On Error Resume Next
ProcProperties = ProcPropertiesInt(ProcIndex)
DisplayError
End Function
Function ProcPropertiesInt(ProcIndex)
Dim CurProc, thisThread, PropText, PropList, PropObj
set CurProc = CheckInitProc(ProcIndex)
set thisThread = CurProc.Thread
set PropList = thisThread.GetProcProperties
iter = 0
do while iter < 7
set PropObj = PropList(iter)
Select Case iter
case 0:
propType = "vector_catch"
case 1:
propType = "comms_channel"
case 2:
propType = "semihosting_enabled"
case 3:
propType = "semihosting_vector"
case 4:
propType = "semihosting_dcchandler_address"
case 5:
propType = "arm_semihosting_swi"
case 6:
propType = "thumb_semihosting_swi"
End Select
'var = PropObj.GetPropValue
varText = PropObj.FormatValue(iter)
PropText = PropText & propType & Chr(9) & varText & Chr(13) & Chr(10)
iter = iter + 1
Loop
adw3cli.Display(PropText)
End Function
Function SetProcProp(AnyType, NewValue, ProcIndex) '<--- CLI command
On Error Resume Next
SetProcProp = SetProcPropInt(AnyType, NewValue, ProcIndex)
DisplayError
End Function
Function SetProcPropInt(AnyType, NewValue, ProcIndex)
Dim CurProc, thisThread, index, Value, propType
propType = -1
If ProcIndex = -1 Then
set CurProc = CheckInitProc(ProcIndex)
Else
set CurProc = CheckInitProc(ProcIndex)
End If
set thisThread = CurProc.Thread
Select Case AnyType
case "vector_catch":
propType = 0
case "comms_channel":
propType = 1
case "semihosting_enabled":
propType = 2
case "semihosting_vector":
propType = 3
case "semihosting_dcchandler_address":
propType = 4
case "arm_semihosting_swi":
propType = 5
case "thumb_semihosting_swi":
propType = 6
End Select
If propType < 0 or propType > 6 Then
err.raise 1000, "VBScript", "Parameter name specified is not recognised."
End If
If AnyType = "vector_catch" or propType = 1 Then
If IsNumeric(NewValue) = FALSE Then
Dim NewVar
Dim PropList
set PropList = thisThread.GetProcProperties
NewVar = PropList(0).GetValue
OldVarStr = PropList(0).FormatValue(0)
If InStr(NewValue, Chr(82)) <> 0 Then
NewVar = NewVar or &h0001
End If
If InStr(NewValue, Chr(114)) <> 0 and InStr(OldVarStr, Chr(114)) <> 1 Then
NewVar = NewVar xor &h0001
End If
If InStr(NewValue, Chr(85)) <> 0 Then
NewVar = NewVar or &h0002
End If
If InStr(NewValue, Chr(117)) <> 0 and InStr(OldVarStr, Chr(117)) <> 2 Then
NewVar = NewVar xor &h0002
End If
If InStr(NewValue, Chr(83)) <> 0 Then
NewVar = NewVar or &h0004
End If
If InStr(NewValue, Chr(115)) <> 0 and InStr(OldVarStr, Chr(115)) <> 3 Then
NewVar = NewVar xor &h0004
End If
If InStr(NewValue, Chr(80)) <> 0 Then
NewVar = NewVar or &h0008
End If
If InStr(NewValue, Chr(112)) <> 0 and InStr(OldVarStr, Chr(112)) <> 4 Then
NewVar = NewVar xor &h0008
End If
If InStr(NewValue, Chr(68)) <> 0 Then
NewVar = NewVar or &h0010
End If
If InStr(NewValue, Chr(100)) <> 0 and InStr(OldVarStr, Chr(100)) <> 5 Then
NewVar = NewVar xor &h0010
End If
If InStr(NewValue, Chr(73)) <> 0 Then
NewVar = NewVar or &h0040
End If
If InStr(NewValue, Chr(105)) <> 0 and InStr(OldVarStr, Chr(105)) <> 6 Then
NewVar = NewVar xor &h0040
End If
If InStr(NewValue, Chr(70)) <> 0 Then
NewVar = NewVar or &h0080
End If
If InStr(NewValue, Chr(102)) <> 0 and InStr(OldVarStr, Chr(102)) <> 7 Then
NewVar = NewVar xor &h0080
End If
NewValue = NewVar
End If
Else
NewValue = Unsigned(ExprToAddress(NewValue))
End If
call thisThread.SetProcProperties(propType, NewValue)
End Function
Function LoadSymbols(FileName, ProcIndex) '<--- CLI command
On Error Resume Next
LoadSymbols = LoadSymbolsInt(FileName, ProcIndex)
DisplayError
End Function
Function LoadSymbolsInt(FileName, ProcIndex)
Dim res, index
Dim CurProc
If ProcIndex = -1 Then
set CurProc = GetCurrentProcessor
Else
set CurProc = GetObjFromKey(ProcIndex, ProcList, ProcNameString, ProcIDString, index)
End If
call session.LoadSymbols(FileName, CurProc.Handle)
End Function
Function Reload(ImageIndex) '<--- CLI command
On Error Resume Next
Reload = ReloadInt(ImageIndex)
DisplayError
End Function
Function GetImageHandle(ImageIndex)
Dim CurImage
Set CurImage = CheckForImage(ImageIndex)
GetImageHandle = CurImage.Handle
End Function
Function ReloadInt(ImageIndex)
Dim ImageHandle
ImageHandle = GetImageHandle(ImageIndex)
call session.ReloadImage(ImageHandle)
ImageLoadFlag = TRUE
call UpdateImageList
End Function
Function LoadBinary(FileName, ExprStr) '<--- CLI command
On Error Resume Next
LoadBinary = LoadBinaryInt(FileName, ExprStr)
DisplayError
End Function
Function LoadBinaryInt(FileName, ExprStr)
Dim CurProc, Address
set CurProc = GetCurrentProcessor
Address = ExprToAddress(ExprStr)
call session.LoadFileToMem(FileName, Address, CurProc.Handle)
End Function
Function SaveBinary(FileName, Expr1, Expr2) '<--- CLI command
On Error Resume Next
SaveBinary = SaveBinaryInt(FileName, Expr1, Expr2)
DisplayError
End Function
Function SaveBinaryInt(FileName, StartAddress, EndAddress)
Dim CurProc, Range
If Left(EndAddress, 1) = Chr(43) Then
Range = ComRange(StartAddress, EndAddress) -1
Else
Range = ComRange(StartAddress, EndAddress) - 1
End If
set CurProc = GetCurrentProcessor
call session.DumpMemToFile(FileName, StartAddress, StartAddress+Range, CurProc.Handle)
End Function
'''''''''''''''''''''''''''''''''''''''
' Create global processor list
''''''''''''''''''''''''''''''''''''''
Function processors() '<--- CLI command
On Error Resume Next
processors = processorsInt()
DisplayError
End Function
Function processorsInt() '<---- CLI function
dim txt
call CheckInitProc(-1)
txt = headtext + ProcListText
adw3cli.Display(txt)
End Function
Function Images() '<--- CLI command
On Error Resume Next
Images = ImagesInt()
DisplayError
End Function
Function CheckForImage(ImageIndex)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -