⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.frm

📁 用VB编的51单片机反汇编程序
💻 FRM
📖 第 1 页 / 共 2 页
字号:
   End
   Begin VB.CommandButton BtnLoad 
      Caption         =   "打开"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   21.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   585
      Left            =   4590
      TabIndex        =   1
      Top             =   675
      Width           =   1140
   End
   Begin VB.TextBox Td 
      Height          =   5865
      Left            =   45
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   0
      Text            =   "FrmMain.frx":0004
      Top             =   45
      Width           =   4470
   End
   Begin VB.Label LStatus 
      BorderStyle     =   1  'Fixed Single
      Caption         =   "LStatus"
      Height          =   240
      Left            =   45
      TabIndex        =   5
      Top             =   5940
      Width           =   6180
   End
   Begin VB.Menu MOpen 
      Caption         =   "&Open"
   End
   Begin VB.Menu MSet 
      Caption         =   "Se&t"
   End
   Begin VB.Menu MNASM 
      Caption         =   "&NASM"
   End
   Begin VB.Menu MSave 
      Caption         =   "&Save"
   End
   Begin VB.Menu Mab 
      Caption         =   "&About"
      Begin VB.Menu Mabout 
         Caption         =   "关于"
      End
      Begin VB.Menu MSep 
         Caption         =   "-"
      End
      Begin VB.Menu MReg 
         Caption         =   "注册软件"
      End
   End
   Begin VB.Menu MExit 
      Caption         =   "&Exit"
   End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Fso As New FileSystemObject
Dim hFile As TextStream

Private Sub BtnAddDB_Click()
With FrmAdd
    .Show
    .DType = 1
    '.Label3.Visible = False
    '.TNLength.Visible = False
    '.Label6.Visible = False
End With
End Sub

Private Sub BtnAddDW_Click()
With FrmAdd
    .Show
    .DType = 2
End With
End Sub

Private Sub BtnAddPro_Click()
With FrmAdd
    .Show
    .DType = 0
    .Label3.Visible = False
    .TNLength.Visible = False
    .Label6.Visible = False
End With
End Sub

Private Sub BtnClose_Click()
FraSet.Visible = False
Me.Width = FraSet.Left + 200
End Sub

Private Sub BtnDelD_Click()
Dim i As Long
'Dim TCP As MyPort
If LData.ListIndex <= 0 Or SP < 1 Then Exit Sub
For i = LData.ListIndex To SP
    DataIn(i - 1) = DataIn(i)
Next i
DP = DP - 1
BtnSet_Click
End Sub

Private Sub BtnDelPro_Click()
Dim i As Long
'Dim TCP As MyPort
If LPro.ListIndex <= 0 Or SP < 1 Then Exit Sub
For i = LPro.ListIndex To IP
    ProIn(i - 1) = ProIn(i)
Next i
IP = IP - 1
BtnSet_Click
End Sub

Private Sub BtnDisplay_Click()
FrmDisplay.Show
End Sub

Private Sub BtnEnd_Click()
End
End Sub

Private Sub BtnLoad_Click()
Dim TSL As String
Dim Res As Boolean
Dim Num, i As Integer
Dim Addr As Long
Td.Text = "打开的十六进制文件内容为:"
CD.Filter = "*.Hex(十六进制文件)|*.Hex|*.*(所有文件)|*.*"
CD.ShowOpen
OpenFilePathName = CD.FileName
If Len(OpenFilePathName) < 5 Then Exit Sub
CD.FileName = ""
LStatus.Caption = "打开的文件:" + OpenFilePathName + "   保存的文件:" + SaveFilePathName
On Error GoTo EBtnLoad
Set hFile = Fso.OpenTextFile(OpenFilePathName, ForReading)
Do While Not hFile.AtEndOfStream
    TSL = hFile.ReadLine
    Td.Text = Td.Text + L + TSL
    Num = Val("&H" + Mid(TSL, 2, 2))
    Addr = Val4Hex("&H" + Mid(TSL, 4, 4))
    For i = 0 To Num - 1
        BD(Addr + i).D = Val("&H" + Mid(TSL, 10 + 2 * i, 2))
    Next i
Loop
hFile.Close
Exit Sub
EBtnLoad:
MsgBox "打开文件失败!"
End Sub

Private Sub BtnOK_Click()
FraSet.Visible = False
Me.Width = FraSet.Left
End Sub

Private Sub BtnSave_Click()
Dim TS As String
Dim Num, i As Long
Dim Addr As Long
'Td.Text = "打开的十六进制文件内容为:"
CD.Filter = "*.Txt(十六进制文件)|*.TXT|*.ASM|*.ASM|*.A51|*.A51|*.*(所有文件)|*.*"
CD.ShowSave
SaveFilePathName = CD.FileName
If Left(Right(SaveFilePathName, 4), 1) = "." Then
    TS = SaveFilePathName
    SaveFilePathName = Left(SaveFilePathName, Len(SaveFilePathName) - 4)
    Select Case CD.FilterIndex
    Case 1:
        SaveFilePathName = SaveFilePathName + ".TXT"
    Case 2:
        SaveFilePathName = SaveFilePathName + ".ASM"
    Case 3:
        SaveFilePathName = SaveFilePathName + "A51"
    Case Else
        SaveFilePathName = TS
    End Select
End If
LStatus.Caption = "打开的文件:" + OpenFilePathName + "   保存的文件:" + SaveFilePathName
On Error GoTo EBtnLoad
Set hFile = Fso.OpenTextFile(SaveFilePathName, ForWriting, True)
For i = 0 To 65535
    If Len(ASM(i)) > 0 Then hFile.WriteLine ASM(i)
Next i
hFile.WriteLine ""
hFile.WriteLine "      END"
hFile.Close
Exit Sub
EBtnLoad:
'MsgBox "打开文件失败!"
End Sub

Public Sub BtnSet_Click()
Dim i As Long
Dim tl As String
FraSet.Visible = True
Me.Width = FraSet.Left + FraSet.Width + 200
LPro.Clear
LData.Clear
LPro.AddItem "行标号,入口地址", 0
For i = 1 To IP
    LPro.AddItem ProIn(i - 1).Label + "  " + MyHex(ProIn(i - 1).Addr), i
Next i
LData.AddItem "行标号 入口地址 类型 长度", 0
For i = 1 To DP
    If DataIn(i - 1).DType Then
        tl = "DB"
    Else
        tl = "DW"
    End If
    LData.AddItem DataIn(i - 1).Label + "  " + MyHex(DataIn(i - 1).Addr) + "  " + tl + "  " + MyHex(DataIn(i - 1).Length), i
Next i
End Sub

Private Sub BtnTrans_Click()
StartNASM
End Sub

Private Sub Form_Load()
BtnTrans.Enabled = User_OK
MNASM.Enabled = User_OK
If Reg_OK = False Then
    Me.Caption = Me.Caption + "(未注册版)"
Else
    Me.Caption = Me.Caption + "(注册版)"
End If
LStatus.Caption = "打开的文件:" + OpenFilePathName + "   保存的文件:" + SaveFilePathName
Td.Text = ""
SP = 0
PUSH "BEGIN:", 0
End Sub

Private Sub Form_Resize()
If Me.Height < 1000 Then Exit Sub
Td.Height = Me.Height - LStatus.Height - 1000
LStatus.Top = Me.Height - LStatus.Height - 400
LStatus.Width = Me.Width - 200
End Sub

Private Sub MAbout_Click()
frmAbout.Show vbModal
End Sub

Private Sub MExit_Click()
End
End Sub

Private Sub MNASM_Click()
BtnTrans_Click
End Sub

Private Sub MOpen_Click()
BtnLoad_Click
End Sub

Private Sub MReg_Click()
FrmReg.Show
End Sub

Private Sub MSave_Click()
BtnSave_Click
End Sub

Private Sub MSet_Click()
BtnSet_Click
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -