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

📄 calc.lst

📁 代码保护功能处于持续发展中。Microchip 承诺将不断改进产品的代码保护功能。任何试图破坏Microchip 代码保护功能的行为均可视 为违反了《数字器件千年版权法案(Digital Mille
💻 LST
📖 第 1 页 / 共 4 页
字号:
0067   2040           00101         CALL    send            ; and send code
0068   300C           00102         MOVLW   0x0C            ; Turn on display  
0069   2040           00103         CALL    send            ; and send code
                      00104 
006A   0008           00105         RETURN                  ; Done
                      00106 
                      00107 ;--------------------------------------------------------------
                      00104 
                      00105 
                      00106 ; Scan keypad .............................................
                      00107 
006B   300F           00108 keyin   MOVLW   00F             ; deselect..
006C   0087           00109         MOVWF   PORTC           ; ..all rows
006D   1007           00110         BCF     PORTC,0         ; select row A
006E   2030           00111         CALL    onems           ; wait output stable
                      00112 
006F   1A07           00113         BTFSC   PORTC,4         ; button 7?
0070   2876           00114         GOTO    b8              ; no
0071   3037           00115         MOVLW   '7'             ; yes
0072   00B0           00116         MOVWF   Char            ; load key code
0073   3007           00117         MOVLW   07              ; and
0074   00C0           00118         MOVWF   Kval            ; key value
0075   0008           00119         RETURN
                      00120 
0076   1A87           00121 b8      BTFSC   PORTC,5         ; button 8?
0077   287D           00122         GOTO    b9              ; no
0078   3038           00123         MOVLW   '8'             ; yes   
0079   00B0           00124         MOVWF   Char
007A   3008           00125         MOVLW   08
007B   00C0           00126         MOVWF   Kval
007C   0008           00127         RETURN
                      00128         
007D   1B07           00129 b9      BTFSC   PORTC,6         ; button 9?
007E   2884           00130         GOTO    bd              ; no
007F   3039           00131         MOVLW   '9'             ; yes
0080   00B0           00132         MOVWF   Char
0081   3009           00133         MOVLW   09
0082   00C0           00134         MOVWF   Kval
0083   0008           00135         RETURN
                      00136         
0084   1B87           00137 bd      BTFSC   PORTC,7         ; button /?
0085   288A           00138         GOTO    rowb            ; no
0086   302F           00139         MOVLW   '/'             ; yes
0087   00B0           00140         MOVWF   Char            ; store key code
0088   00B4           00141         MOVWF   Oper            ; store operator symbol
0089   0008           00142         RETURN
                      00143 
008A   1407           00144 rowb    BSF     PORTC,0         ; select row B
MPASM 03.70.01 Released                              CALC.ASM   3-7-2006  14:36:19         PAGE  6


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

008B   1087           00145         BCF     PORTC,1
008C   2030           00146         CALL    onems
                      00147 
008D   1A07           00148         BTFSC   PORTC,4         ; button 4?
008E   2894           00149         GOTO    b5              ; no
008F   3034           00150         MOVLW   '4'             ; yes
0090   00B0           00151         MOVWF   Char
0091   3004           00152         MOVLW   04
0092   00C0           00153         MOVWF   Kval
0093   0008           00154         RETURN
                      00155         
0094   1A87           00156 b5      BTFSC   PORTC,5         ; button 5?
0095   289B           00157         GOTO    b6              ; no
0096   3035           00158         MOVLW   '5'             ; yes
0097   00B0           00159         MOVWF   Char
0098   3005           00160         MOVLW   05
0099   00C0           00161         MOVWF   Kval
009A   0008           00162         RETURN
                      00163         
009B   1B07           00164 b6      BTFSC   PORTC,6         ; button 6?
009C   28A2           00165         GOTO    bm              ; no
009D   3036           00166         MOVLW   '6'             ; yes
009E   00B0           00167         MOVWF   Char
009F   3006           00168         MOVLW   06
00A0   00C0           00169         MOVWF   Kval
00A1   0008           00170         RETURN
                      00171         
00A2   1B87           00172 bm      BTFSC   PORTC,7         ; button x?
00A3   28A8           00173         GOTO    rowc            ; no
00A4   3078           00174         MOVLW   'x'             ; yes
00A5   00B0           00175         MOVWF   Char
00A6   00B4           00176         MOVWF   Oper
00A7   0008           00177         RETURN
                      00178 
00A8   1487           00179 rowc    BSF     PORTC,1         ; select row C
00A9   1107           00180         BCF     PORTC,2
00AA   2030           00181         CALL    onems
                      00182 
00AB   1A07           00183         BTFSC   PORTC,4         ; button 1?
00AC   28B2           00184         GOTO    b2              ; no
00AD   3031           00185         MOVLW   '1'             ; yes
00AE   00B0           00186         MOVWF   Char
00AF   3001           00187         MOVLW   01
00B0   00C0           00188         MOVWF   Kval
00B1   0008           00189         RETURN
                      00190                 
00B2   1A87           00191 b2      BTFSC   PORTC,5         ; button 2?
00B3   28B9           00192         GOTO    b3              ; no
00B4   3032           00193         MOVLW   '2'             ; yes
00B5   00B0           00194         MOVWF   Char
00B6   3002           00195         MOVLW   02
00B7   00C0           00196         MOVWF   Kval
00B8   0008           00197         RETURN
MPASM 03.70.01 Released                              CALC.ASM   3-7-2006  14:36:19         PAGE  7


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00198         
00B9   1B07           00199 b3      BTFSC   PORTC,6         ; button 3?
00BA   28C0           00200         GOTO    bs              ; no
00BB   3033           00201         MOVLW   '3'             ; yes
00BC   00B0           00202         MOVWF   Char
00BD   3003           00203         MOVLW   03
00BE   00C0           00204         MOVWF   Kval
00BF   0008           00205         RETURN
                      00206 
00C0   1B87           00207 bs      BTFSC   PORTC,7         ; button -?
00C1   28C6           00208         GOTO    rowd            ; no
00C2   302D           00209         MOVLW   '-'             ; yes
00C3   00B0           00210         MOVWF   Char
00C4   00B4           00211         MOVWF   Oper
00C5   0008           00212         RETURN
                      00213 
00C6   1507           00214 rowd    BSF     PORTC,2         ; select row D
00C7   1187           00215         BCF     PORTC,3
00C8   2030           00216         CALL    onems
                      00217 
00C9   1A07           00218         BTFSC   PORTC,4         ; button C?
00CA   28CF           00219         GOTO    b0              ; no    
00CB   3063           00220         MOVLW   'c'             ; yes
00CC   00B0           00221         MOVWF   Char
00CD   00B4           00222         MOVWF   Oper
00CE   0008           00223         RETURN
                      00224                 
00CF   1A87           00225 b0      BTFSC   PORTC,5         ; button 0?
00D0   28D6           00226         GOTO    be              ; no
00D1   3030           00227         MOVLW   '0'             ; yes
00D2   00B0           00228         MOVWF   Char
00D3   3000           00229         MOVLW   00
00D4   00C0           00230         MOVWF   Kval
00D5   0008           00231         RETURN
                      00232         
00D6   1B07           00233 be      BTFSC   PORTC,6         ; button =?
00D7   28DB           00234         GOTO    bp              ; no
00D8   303D           00235         MOVLW   '='             ; yes
00D9   00B0           00236         MOVWF   Char
00DA   0008           00237         RETURN
                      00238 
00DB   1B87           00239 bp      BTFSC   PORTC,7         ; button +?
00DC   28E1           00240         GOTO    done            ; no
00DD   302B           00241         MOVLW   '+'             ; yes
00DE   00B0           00242         MOVWF   Char
00DF   00B4           00243         MOVWF   Oper
00E0   0008           00244         RETURN
                      00245 
00E1   1587           00246 done    BSF     PORTC,3         ; clear last row
00E2   01B0           00247         CLRF    Char            ; character code = 0
00E3   0008           00248         RETURN
                      00249 
                      00250 
MPASM 03.70.01 Released                              CALC.ASM   3-7-2006  14:36:19         PAGE  8


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00251 ; Write display ...........................................
                      00252 
00E4   0837           00253 disout  MOVF    Kcode,W         ; Load the code
00E5   14F4           00254         BSF     Select,RS       ; Select data mode
00E6   2040           00255         CALL    send            ; and send code
00E7   0008           00256         RETURN
                      00257 
                      00258 ; Process operations ......................................
                      00259 
00E8   0834           00260 calc    MOVF    Oper,W          ; check for add
00E9   00B5           00261         MOVWF   Temp            ; load input op code
00EA   302B           00262         MOVLW   '+'             ; load plus code
Message[305]: Using default destination of 1 (file).
00EB   02B5           00263         SUBWF   Temp            ; compare
00EC   1903           00264         BTFSC   STATUS,Z        ; and check if same
00ED   2901           00265         GOTO    add             ; yes, jump to op
                      00266 
00EE   0834           00267         MOVF    Oper,W          ; check for subtract 
00EF   00B5           00268         MOVWF   Temp
00F0   302D           00269         MOVLW   '-'
Message[305]: Using default destination of 1 (file).
00F1   02B5           00270         SUBWF   Temp
00F2   1903           00271         BTFSC   STATUS,Z
00F3   2905           00272         GOTO    sub
                      00273 
00F4   0834           00274         MOVF    Oper,W          ; check for multiply 
00F5   00B5           00275         MOVWF   Temp
00F6   3078           00276         MOVLW   'x'
Message[305]: Using default destination of 1 (file).
00F7   02B5           00277         SUBWF   Temp
00F8   1903           00278         BTFSC   STATUS,Z
00F9   2912           00279         GOTO    mul
                      00280         
00FA   0834           00281         MOVF    Oper,W          ; check for divide
00FB   00B5           00282         MOVWF   Temp
00FC   302F           00283         MOVLW   '/'
Message[305]: Using default destination of 1 (file).
00FD   02B5           00284         SUBWF   Temp
00FE   1903           00285         BTFSC   STATUS,Z
00FF   2918           00286         GOTO    div
0100   2813           00287         GOTO    scan            ; rescan if key invalid
                      00288 
                      00289 
                      00290 ; Calclate results from 2 input numbers ...................
                      00291  
0101   0831           00292 add     MOVF    Num1,W          ; get first number
0102   0732           00293         ADDWF   Num2,W          ; add second
0103   00B3           00294         MOVWF   Result          ; and store result
0104   292F           00295         GOTO    outres          ; display result
                      00296 
                      00297 
0105   1403           00298 sub     BSF     STATUS,C        ; Negative detect flag
0106   0832           00299         MOVF    Num2,W          ; get first number
MPASM 03.70.01 Released                              CALC.ASM   3-7-2006  14:36:19         PAGE  9


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0107   0231           00300         SUBWF   Num1,W          ; subtract second
0108   00B3           00301         MOVWF   Result          ; and store result
                      00302         
0109   1C03           00303         BTFSS   STATUS,C        ; answer negative?
010A   290C           00304         GOTO    minus           ; yes, minus result
010B   292F           00305         GOTO    outres          ; display result
                      00306 
010C   302D           00307 minus   MOVLW   '-'             ; load minus sign       
010D   14F4           00308         BSF     Select,RS       ; Select data mode
010E   2040           00309         CALL    send            ; and send symbol
                      00310 
Message[305]: Using default destination of 1 (file).
010F   09B3           00311         COMF    Result          ; invert all bits
Message[305]: Using default destination of 1 (file).
0110   0AB3           00312         INCF    Result          ; add 1
0111   292F           00313         GOTO    outres          ; display result

⌨️ 快捷键说明

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