📄 form1.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmMain
Caption = "Disassembler"
ClientHeight = 6015
ClientLeft = 165
ClientTop = 450
ClientWidth = 5895
LinkTopic = "Form1"
ScaleHeight = 6015
ScaleWidth = 5895
StartUpPosition = 3 'Windows Default
Begin MSComDlg.CommonDialog CommonDialog
Left = 5280
Top = 240
_ExtentX = 847
_ExtentY = 847
_Version = 393216
CancelError = -1 'True
Filter = "All Files (*.*)"
FilterIndex = 2
Flags = 4100
End
Begin VB.TextBox txtCodeDesc
BackColor = &H00C0C0C0&
Height = 4335
Left = 3960
Locked = -1 'True
MultiLine = -1 'True
TabIndex = 14
Top = 1560
Width = 1815
End
Begin VB.Frame frmLoad
Caption = "&File"
Height = 1095
Left = 120
TabIndex = 0
Top = 120
Width = 5055
Begin VB.Frame frmBit
Caption = "&Load Mode"
Height = 855
Left = 1320
TabIndex = 15
ToolTipText = "Helps when it reads immediate address values"
Top = 120
Width = 1095
Begin VB.OptionButton optBit
Caption = "16 Bit"
Height = 255
Index = 0
Left = 120
TabIndex = 17
Top = 240
Value = -1 'True
Width = 855
End
Begin VB.OptionButton optBit
Caption = "32 Bit"
Height = 255
Index = 1
Left = 120
TabIndex = 16
ToolTipText = "* Instruction Prefixes ignored, so some 16 Bit instructions will cause cascading problems *"
Top = 480
Width = 855
End
End
Begin VB.CommandButton cmdSaveFile
Caption = "&Save ASM"
Height = 375
Left = 120
TabIndex = 2
Top = 600
Width = 975
End
Begin VB.TextBox txtOffset
Enabled = 0 'False
Height = 285
Left = 4440
TabIndex = 8
Text = "0000"
ToolTipText = "Value in HEX"
Top = 720
Width = 495
End
Begin VB.OptionButton optOffset
Caption = "Custom"
Enabled = 0 'False
Height = 255
Index = 3
Left = 3480
TabIndex = 7
Top = 720
Width = 975
End
Begin VB.OptionButton optOffset
Caption = "Bin / None"
Enabled = 0 'False
Height = 255
Index = 2
Left = 3480
TabIndex = 6
Top = 480
Value = -1 'True
Width = 1335
End
Begin VB.OptionButton optOffset
Caption = "COM"
Enabled = 0 'False
Height = 255
Index = 1
Left = 2640
TabIndex = 5
Top = 720
Width = 855
End
Begin VB.OptionButton optOffset
Caption = "Boot"
Enabled = 0 'False
Height = 255
Index = 0
Left = 2640
TabIndex = 4
Top = 480
Width = 855
End
Begin VB.CommandButton cmdLoadFile
Caption = "&Load File"
Default = -1 'True
Height = 375
Left = 120
TabIndex = 1
Top = 240
Width = 975
End
Begin VB.Label lbl
Caption = "Save &Offset:"
Enabled = 0 'False
Height = 255
Index = 3
Left = 2640
TabIndex = 3
Top = 240
Width = 1095
End
End
Begin VB.ListBox lstAssembly
BackColor = &H00C0C0C0&
Height = 4350
ItemData = "Form1.frx":0000
Left = 1560
List = "Form1.frx":0002
TabIndex = 12
ToolTipText = "All numerics are in Hex"
Top = 1560
Width = 2295
End
Begin VB.ListBox lstFileCont
BackColor = &H00C0C0C0&
ForeColor = &H00000000&
Height = 4350
ItemData = "Form1.frx":0004
Left = 120
List = "Form1.frx":0006
TabIndex = 10
Top = 1560
Width = 1335
End
Begin VB.Label lbl
Caption = "Opcode Infomation:"
Height = 255
Index = 2
Left = 4080
TabIndex = 13
Top = 1320
Width = 1575
End
Begin VB.Label lbl
Caption = "Assembly Code:"
Height = 255
Index = 1
Left = 1680
TabIndex = 11
Top = 1320
Width = 1335
End
Begin VB.Label lbl
Caption = "File Contents:"
Height = 255
Index = 0
Left = 240
TabIndex = 9
Top = 1320
Width = 1095
End
Begin VB.Menu mnuPopup
Caption = "Popup"
Visible = 0 'False
Begin VB.Menu mnuJump
Caption = "&Jump with command"
Enabled = 0 'False
End
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Sorry about it being a bit messy - most of the data is loaded from the .info files
' so you can look at them to see the information
' There are only two main subs to check "Form_Load" and "cmdLoadFile_Click"
Dim OpCodes() As String ' Check "Form_Load"
Dim RMByteInfo(3, 7, 1) As String ' 1st=Mod, 2nd=R/M, 3rd=16/32Bit
Dim AssListClickInfo() As Long ' Saves the type of Opcode detail number for the List box
Private Sub cmdLoadFile_Click()
On Error Resume Next ' Required
CommonDialog.DialogTitle = "Select File to Open"
CommonDialog.ShowOpen
If Err Then Exit Sub
If FileLen(CommonDialog.FileName) > 65536 Then MsgBox "Sorry the file is too big," & vbCr & "only the first 64K loaded", vbExclamation, "Error"
Dim fileChar As String * 1
Dim I As Long, II As Long ' For Counters
lstFileCont.Clear
lstAssembly.Clear
txtCodeDesc = ""
' Copy file contents to the first list box
Open CommonDialog.FileName For Binary Access Read As #4
Do
fileChar = Input(1, 4)
If EOF(4) Then Exit Do
HexVal = Hex(Asc(fileChar))
lstFileCont.AddItem FormatStr(I, 4) & " " & String(2 - Len(HexVal), "0") & HexVal & Chr$(9) & " " & fileChar
'lstFileCont.ItemData(lstFileCont.NewIndex) = -1 ' temp
I = I + 1
Loop Until (I = 65536) ' (2 ^ 16)
Close #4
ReDim Preserve AssListClickInfo(lstFileCont.NewIndex) As Long ' - The end of the array is wasted, For the mouse clicks
lstFileCont.Refresh
'Dim firstOp As Long, secOp As Long, III As Long, LinePos As Long, LinePos2 As Long ' Mostly counters
Dim tempOp As Long
'Dim Comms() As String ' The commands cut into this array
'Dim BytesOnOperand As Long
' Convert bytes to viewable code
For I = 0 To lstFileCont.ListCount - 1
' Get Opcodes
FileHexVal = Mid$(lstFileCont.List(I), 7, 2) ' A Hex value from the file
For II = 0 To UBound(OpCodes(), 2)
' Max Should = 5, Opcodes & Operands
If FileHexVal = Left$(OpCodes(0, II), 2) Then ' Does first file Opcode match the Opcode list
Err = 0
tempHexVal = Mid$(OpCodes(0, II), 3, 2)
tempOp = CLng("&H" & tempHexVal) ' Check for second Opcode
If Err.Number = 13 Or tempHexVal <> UCase$(tempHexVal) Then ' No second Opcode
'I = I + 1
I = ProcessOperands(I, Mid$(OpCodes(0, II), 3), II)
Exit For
Else
If Mid$(lstFileCont.List(I + 1), 7, 2) <> tempHexVal Then GoTo SkipOutofThis ' Check is second Opcodes match
tempHexVal = Mid$(OpCodes(0, II), 5, 2)
tempOp = CLng("&H" & Mid$(OpCodes(0, II), 5, 2)) ' Check for third Opcode
If Err.Number = 13 Or tempHexVal <> UCase$(tempHexVal) Then
I = I + 1 '2
I = ProcessOperands(I, Mid$(OpCodes(0, II), 5), II) ' No third Opcode
Exit For
Else
If Mid$(lstFileCont.List(I + 2), 7, 2) <> tempHexVal Then GoTo SkipOutofThis ' Check is third Opcodes match
I = I + 2 '3
I = ProcessOperands(I, Mid$(OpCodes(0, II), 7), II)
Exit For
End If
End If
End If
SkipOutofThis:
Next II
If II = UBound(OpCodes(), 2) + 1 Then ' If the Opcode(s) are not found in the list
lstAssembly.AddItem "Unknown Command " & FileHexVal
lstAssembly.ItemData(lstAssembly.NewIndex) = I ' For the mouse click
lstFileCont.ItemData(I) = lstAssembly.NewIndex
AssListClickInfo(lstAssembly.NewIndex) = -1
End If
Next I
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -