📄 calc.lst
字号:
00314
00315
0112 0831 00316 mul MOVF Num1,W ; get first number
0113 01B3 00317 CLRF Result ; total to Z
Message[305]: Using default destination of 1 (file).
0114 07B3 00318 add1 ADDWF Result ; add to total
Message[305]: Using default destination of 1 (file).
0115 0BB2 00319 DECFSZ Num2 ; num2 times and
0116 2914 00320 GOTO add1 ; repeat if not done
0117 292F 00321 GOTO outres ; done, display result
00322
00323
0118 01B3 00324 div CLRF Result ; total to Z
0119 0832 00325 MOVF Num2,W ; get divisor
011A 1003 00326 BCF STATUS,C ; set C flag
Message[305]: Using default destination of 1 (file).
011B 0AB3 00327 sub1 INCF Result ; count loop start
Message[305]: Using default destination of 1 (file).
011C 02B1 00328 SUBWF Num1 ; subtract
011D 1D03 00329 BTFSS STATUS,Z ; exact answer?
011E 2920 00330 GOTO neg ; no
011F 292F 00331 GOTO outres ; yes, display answer
0120 1803 00332 neg BTFSC STATUS,C ; gone negative?
0121 291B 00333 GOTO sub1 ; no - repeat
Message[305]: Using default destination of 1 (file).
0122 03B3 00334 DECF Result ; correct the result
0123 0832 00335 MOVF Num2,W ; get divisor
Message[305]: Using default destination of 1 (file).
0124 07B1 00336 ADDWF Num1 ; calc remainder
00337
0125 0833 00338 MOVF Result,W ; load result
0126 3E30 00339 ADDLW 030 ; convert to ASCII
0127 14F4 00340 BSF Select,RS ; Select data mode
0128 2040 00341 CALL send ; and send result
00342
0129 3072 00343 MOVLW 'r' ; indicate remainder
012A 2040 00344 CALL send
MPASM 03.70.01 Released CALC.ASM 3-7-2006 14:36:19 PAGE 10
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
012B 0831 00345 MOVF Num1,W
012C 3E30 00346 ADDLW 030 ; convert to ASCII
012D 2040 00347 CALL send
012E 2813 00348 GOTO scan
00349
00350
00351 ; Convert binary to BCD ...................................
00352
012F 0833 00353 outres MOVF Result,W ; load result
0130 00B9 00354 MOVWF Lsd ; into low digit store
0131 01B8 00355 CLRF Msd ; high digit = 0
0132 1403 00356 BSF STATUS,C ; set C flag
0133 300A 00357 MOVLW D'10' ; load 10
00358
Message[305]: Using default destination of 1 (file).
0134 02B9 00359 again SUBWF Lsd ; sub 10 from result
Message[305]: Using default destination of 1 (file).
0135 0AB8 00360 INCF Msd ; inc high digit
0136 1803 00361 BTFSC STATUS,C ; check if negative
0137 2934 00362 GOTO again ; no, keep going
Message[305]: Using default destination of 1 (file).
0138 07B9 00363 ADDWF Lsd ; yes, add 10 back
Message[305]: Using default destination of 1 (file).
0139 03B8 00364 DECF Msd ; inc high digit
00365
00366
00367 ; display 2 digit BCD result ..............................
00368
013A 0838 00369 MOVF Msd,W ; load high digit result
013B 1903 00370 BTFSC STATUS,Z ; check if Z
013C 2940 00371 GOTO lowd ; yes, dont display Msd
00372
013D 3E30 00373 ADDLW 030 ; convert to ASCII
013E 14F4 00374 BSF Select,RS ; Select data mode
013F 2040 00375 CALL send ; and send Msd
00376
0140 0839 00377 lowd MOVF Lsd,W ; load low digit result
0141 3E30 00378 ADDLW 030 ; convert to ASCII
0142 14F4 00379 BSF Select,RS ; Select data mode
0143 2040 00380 CALL send ; and send Msd
00381
0144 2813 00382 GOTO scan ; scan for clear key
00383
00384
00385 ; Restart ................................................
00386
0145 3001 00387 clear MOVLW 01 ; code to clear display
0146 10F4 00388 BCF Select,RS ; Select data mode
0147 2040 00389 CALL send ; and send code
0148 01B6 00390 CLRF Kcount ; reset count of keys
0149 2813 00391 GOTO scan ; and rescan keypad
00392
00393
MPASM 03.70.01 Released CALC.ASM 3-7-2006 14:36:19 PAGE 11
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00394 END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MPASM 03.70.01 Released CALC.ASM 3-7-2006 14:36:19 PAGE 12
SYMBOL TABLE
LABEL VALUE
ACKDT 00000005
ACKEN 00000004
ACKSTAT 00000006
ADCON0 0000001F
ADCON1 0000009F
ADCS0 00000006
ADCS1 00000007
ADDEN 00000003
ADFM 00000007
ADIE 00000006
ADIF 00000006
ADON 00000000
ADRESH 0000001E
ADRESL 0000009E
BCLIE 00000003
BCLIF 00000003
BF 00000000
BRGH 00000002
C 00000000
C1INV 00000004
C1OUT 00000006
C2INV 00000005
C2OUT 00000007
CCP1CON 00000017
CCP1IE 00000002
CCP1IF 00000002
CCP1M0 00000000
CCP1M1 00000001
CCP1M2 00000002
CCP1M3 00000003
CCP1X 00000005
CCP1Y 00000004
CCP2CON 0000001D
CCP2IE 00000000
CCP2IF 00000000
CCP2M0 00000000
CCP2M1 00000001
CCP2M2 00000002
CCP2M3 00000003
CCP2X 00000005
CCP2Y 00000004
CCPR1H 00000016
CCPR1L 00000015
CCPR2H 0000001C
CCPR2L 0000001B
CHS0 00000003
CHS1 00000004
CHS2 00000005
CIS 00000003
CKE 00000006
CKP 00000004
CM0 00000000
CM1 00000001
MPASM 03.70.01 Released CALC.ASM 3-7-2006 14:36:19 PAGE 13
SYMBOL TABLE
LABEL VALUE
CM2 00000002
CMCON 0000009C
CMIE 00000006
CMIF 00000006
CREN 00000004
CSRC 00000007
CVR0 00000000
CVR1 00000001
CVR2 00000002
CVR3 00000003
CVRCON 0000009D
CVREN 00000007
CVROE 00000006
CVRR 00000005
Char 00000030
D 00000005
DATA_ADDRESS 00000005
DC 00000001
D_A 00000005
E 00000002
EEADR 0000010D
EEADRH 0000010F
EECON1 0000018C
EECON2 0000018D
EEDATA 0000010C
EEDATH 0000010E
EEIE 00000004
EEIF 00000004
EEPGD 00000007
F 00000001
FERR 00000002
FSR 00000004
GCEN 00000007
GIE 00000007
GO 00000002
GO_DONE 00000002
I2C_DATA 00000005
I2C_READ 00000002
I2C_START 00000003
I2C_STOP 00000004
IBF 00000007
IBOV 00000005
INDF 00000000
INTCON 0000000B
INTE 00000004
INTEDG 00000006
INTF 00000001
IRP 00000007
Kcode 00000037
Kcount 00000036
Kval 00000040
Lsd 00000039
Msd 00000038
MPASM 03.70.01 Released CALC.ASM 3-7-2006 14:36:19 PAGE 14
SYMBOL TABLE
LABEL VALUE
NOT_A 00000005
NOT_ADDRESS 00000005
NOT_BO 00000000
NOT_BOR 00000000
NOT_DONE 00000002
NOT_PD 00000003
NOT_POR 00000001
NOT_RBPU 00000007
NOT_RC8 00000006
NOT_T1SYNC 00000002
NOT_TO 00000004
NOT_TX8 00000006
NOT_W 00000002
NOT_WRITE 00000002
Num1 00000031
Num2 00000032
OBF 00000006
OERR 00000001
OPTION_REG 00000081
Oper 00000034
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -