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

📄 lclist2valv3.frm

📁 开发单片机的汇编程序时
💻 FRM
📖 第 1 页 / 共 2 页
字号:
        str2mul = str2mul * 10
    End If
Loop

End Function
Function bstr2str(ByVal a As String) As String
alen = Len(a)
abak = a
bstr2val = 0
str2mul = 1
alx = 0
Do While alen > 0
    ABC = Right(abak, 1)
    If alen > 1 Then
        abak = Left(abak, alen - 1)
    End If
    alen = alen - 1
    If ABC = "0" Or ABC = "1" Then
        If ABC = "1" Then
            bstr2val = bstr2val + str2mul
        End If
        str2mul = str2mul * 2
    End If
Loop
bstr2str = Format(bstr2val, "#####0")
End Function
Function toupcase(ByVal a As String) As String
la = Len(a) + 1
It = 1
toupcase = ""
Do While It < la
    A1 = Asc(Mid(a, It, 1))
    If A1 > 96 Then
        A1 = A1 - 32
    End If
    toupcase = toupcase + Chr(A1)
    It = It + 1
Loop
End Function

Private Sub lst2val_Click()
LOK = 0
timelbl.Caption = "Waiting"
On Error GoTo NOFILE
outText = ""

FLN = pathstr + "\" + flstr
Open FLN For Input As #10

OUTLN = pathstr + "\" + OUTFLSTR
Open OUTLN For Output As #20

I = Len(OUTFLSTR)

OUTLN = pathstr + "\" + Left(OUTFLSTR, I - 1) + "Y"
Open OUTLN For Output As #30

OUTLN = pathstr + "\" + Left(OUTFLSTR, I - 1) + "Z"
Open OUTLN For Output As #40

I = 1
ILN = 0
lnxyz = 0
LNCON = 0
For K = 1 To 66666
    SFR(K) = ""
Next
SFR(65024) = "A_reg"
SFR(65025) = "B_reg"
SFR(65026) = "C_reg" '7 8 9
SFR(65027) = "D_reg" '7 8 9
SFR(65028) = "E_reg" '7 8 9
SFR(65029) = "F_reg" '7 8 9
SFR(65030) = "PSW_reg"
SFR(65031) = "PCON_reg"
SFR(65032) = "IE_reg"
SFR(65033) = "IP_reg"
SFR(65034) = "SPL_reg"
SFR(65035) = "SPH_reg"
Print #20, "_sfrbyte        A_reg       _at(0XFE00);"
Print #20, "_sfrbyte        B_reg       _at(0XFE01);"
Print #20, "_sfrbyte        C_reg       _at(0XFE02);"
Print #20, "_sfrbyte        PSW_reg     _at(0XFE06);"
Print #20, "_sfrbyte        PCON_reg    _at(0XFE07);"
Print #20, "_sfrbyte        IE_reg      _at(0XFE08);"
Print #20, "_sfrbyte        IP_reg      _at(0XFE09);"
Print #20, "_sfrbyte        SPL_reg     _at(0XFE0A);"
Print #20, "_sfrbyte        SPH_reg     _at(0XFE0B);"
Print #20, "_sfrbyte        A       _at(0XFE00);"
Print #20, "_sfrbyte        B       _at(0XFE01);"
Print #20, "_sfrword        SP       _at(0XFE0A);"
Print #20, "_sfrbyte        PSW     _at(0XFE06);"
Print #20, "_sfrbyte        PCON    _at(0XFE07);"
Print #20, "_sfrbyte        IE      _at(0XFE08);"
Print #20, "_sfrbyte        IP      _at(0XFE09);"
Print #20, "_sfrbyte        SPL     _at(0XFE0A);"
Print #20, "_sfrbyte        SPH     _at(0XFE0B);"
Do While Not EOF(10)
DoEvents
K = 5030
                                            cx = SFR(K)
                                            cx = SFR(65030)
                                            'CX = SFR(K - 1)
    If cx <> "PSW_REG" Then
        XX = 1
    End If
    If LNCON = 0 Then
        Line Input #10, ln1
    End If
    ILN = ILN + 1
    If ILN = 5 Then
        ILN = 5
    End If
    J = Len(ln1)
    jln1 = J
    If LNCON = 0 Then
        I = 1
        lnxyz = 0
        lnnxt = 1
        Do While I < J
            If Asc(Mid(ln1, I, 1)) = 10 Then
                lnxyz = lnxyz + 1
                ln11(lnxyz) = Mid(ln1, lnnxt, I - lnnxt)
                lnnxt = I + 1
          '  ln11(lnxyz) = ln11(lnxyz) + Chr(13)
            End If
            I = I + 1
        Loop
        If lnnxt < I And lnxyz > 0 Then
            lnxyz = lnxyz + 1
            ln11(lnxyz) = Mid(ln1, lnnxt, I - lnnxt)
            LNCON = 1
        Else
            LNCON = 0
        End If
    End If
    If LNCON > 0 Then
        ln1 = ln11(LNCON)
        LNCON = LNCON + 1
        J = Len(ln1)
        jln1 = J
        If lnxyz < LNCON Then
            LNCON = 0
        End If
    End If
    
    If InStr(ln1, "MPAART") > 0 Then
        txt = 1
    End If
    If J >= 23 Then
        char20 = Asc(Mid(ln1, 20, 1))
        char21 = Mid(ln1, 21, 1)
        For I = 22 To J
            char22 = Mid(ln1, I, 1)
            charif = ""
            charelse = ""
            charendif = ""
            If char22 <> " " Then
                charif = toupcase(Mid(ln1, I, 2))
                If J >= 25 Then
                    charelse = toupcase(Mid(ln1, I, 4))
                End If
                If J >= 26 Then
                    charendif = toupcase(Mid(ln1, I, 5))
                End If
                Exit For
            End If
        Next
        If char20 < 58 And char20 > 47 Then
            If InStr(ln1, "W_EWDC") > 0 Then
                txt = txt
            End If
            If char21 = " " Then
                PRINTDEF = ""
                If char22 = ";" Then
                    LOK = LOK + 1
                    If LOK < 10 Then
                        Print #20, "//" + Right$(ln1, J - 20)
                        '
                    Else
                        LOK = 11
                    End If
                ElseIf charif = "IF" Then
                    PRINTDEF = "#if   "
                    If J - I - 2 > 0 Then
                        ln2 = Right(ln1, J - I - 2)
                        K = InStr(ln2, ";")
                        If K = 0 Then
                            PRINTDEF = PRINTDEF + ln2
                        Else
                            PRINTDEF = PRINTDEF + Left(ln2, K - 1) + " //" + Left(ln2, K + 1)
                        End If
                    End If
                    Print #20, PRINTDEF
                    LOK = 0
                ElseIf charelse = "ELSE" Then
                    PRINTDEF = "#else //"
                    If J - I - 4 > 0 Then
                        PRINTDEF = PRINTDEF + Right(ln1, J - I - 4)
                    End If
                    Print #20, PRINTDEF
                    LOK = 0
                ElseIf charelse = "ELIF" Then
                    PRINTDEF = "#elif "
                    If J - I - 4 > 0 Then
                        ln2 = Right(ln1, J - I - 4)
                        K = InStr(ln2, ";")
                        If K = 0 Then
                            PRINTDEF = PRINTDEF + ln2
                        Else
                            PRINTDEF = PRINTDEF + Left(ln2, K - 1) + " //" + Left(ln2, K + 1)
                        End If
                    End If
                    Print #20, PRINTDEF
                    LOK = 0
                ElseIf charendif = "ENDIF" Then
                    PRINTDEF = "#endif //"
                    If J - I - 5 > 0 Then
                        PRINTDEF = PRINTDEF + Right(ln1, J - I - 5)
                    End If
                    Print #20, PRINTDEF
                    LOK = 0
                    
                ElseIf charif = "#I" Then
                    PRINTDEF = "#if   "
                    If J - I - 3 > 0 Then
                        ln2 = Right(ln1, J - I - 3)
                        K = InStr(ln2, ";")
                        If K = 0 Then
                            PRINTDEF = PRINTDEF + ln2
                        Else
                            PRINTDEF = PRINTDEF + Left(ln2, K - 1) + " //" + Left(ln2, K + 1)
                        End If
                    End If
                    Print #20, PRINTDEF
                    LOK = 0
                ElseIf charelse = "#ELS" Then
                    PRINTDEF = "#else //"
                    If J - I - 5 > 0 Then
                        PRINTDEF = PRINTDEF + Right(ln1, J - I - 5)
                    End If
                    Print #20, PRINTDEF
                    LOK = 0
                ElseIf charelse = "#ELI" Then
                    PRINTDEF = "#elseif "
                    If J - I - 5 > 0 Then
                        ln2 = Right(ln1, J - I - 5)
                        K = InStr(ln2, ";")
                        If K = 0 Then
                            PRINTDEF = PRINTDEF + ln2
                        Else
                            PRINTDEF = PRINTDEF + Left(ln2, K - 1) + " //" + Left(ln2, K + 1)
                        End If
                    End If
                    Print #20, PRINTDEF
                    LOK = 0
                ElseIf charendif = "#ENDI" Then
                    PRINTDEF = "#endif //"
                    If J - I - 6 > 0 Then
                        PRINTDEF = PRINTDEF + Right(ln1, J - I - 6)
                    End If
                    Print #20, PRINTDEF
                    LOK = 0
                Else
                    'LOK = 0
                    endj = InStr(ln1, ";")
                    If endj = 0 Then
                        endj = jln1 + 1
                    End If
                    J = 0
                    For I = I To endj
                        ln2 = Mid(ln1, I, endj - I)
                        lspc = InStr(ln2, " ")
                        iln2 = 1
                        J = J + 1
                        If lspc <> 0 Then
                            strx(J) = Mid(ln2, iln2, lspc - iln2)
                        Else
                            strx(J) = ln2
                            lspc = Len(ln2)
                        End If
                        I = I + lspc
                        Do While I < endj
                            midln2 = Mid(ln1, I, 1)
                            If midln2 <> " " Then
                                I = I - 1
                                Exit Do
                            End If
                            I = I + 1
                        Loop
                    Next
                    
                    If J > 1 Then
                        If J > 2 Then
                            c1up = toupcase(strx(1))
                            c2up = toupcase(strx(2))
                            If c1up = "DEFINE" Then
'10                    define TR       'R8'            ;TR-->R8
                                I = Len(strx(3))
'                  11 TRL     EQU     0010H           ;R8壓埵
                                If (Asc(Left(strx(3), 1)) > 47 And Asc(Left(strx(3), 1)) < 58) And (Right(strx(3), 1) = "H" Or Right(strx(3), 1) = "h") Then
                                    strx(3) = "0x" + Left(strx(3), I - 1)
                                End If
'                 156 CP0INI          equ     00010001B       ;撪晹踢俦

⌨️ 快捷键说明

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