?? e4b.asm
字號:
;///////////////////////////////////////////
;本程序源代碼由單片機培訓網提供.
;單片機培訓網,讓更多人學習單片機更容易.
;第一網址----www.mcuedu.com
;第二網址----http://51_train.nease.net
;創辦人------劉永忠
;熱線電話----(0755)27529998
;email-------aa815@163.com
;編寫計算下式的程序,設乘積和平方結果均小于255。A、B值分別存放在3001H和3002H單元中,結果存于片外3000H單元
;中。
; (A+B)*(A+B)+10,(A+B)*(A+B)〈10
;Y= (A+B)*(A+B), (A+B)*(A+B)=10
; (A+B)*(A+B)-10,(A+B)*(A+B)〉10
;程序難易等級--------稍難
;///////////////////////////////////////////
org 0000h
ljmp main
org 0030h
main:
mov dptr,#3001h
mov a,#0ah
movx @dptr,a
mov dptr,#3002h
mov a,#05h
movx @dptr,a
mov dptr,#3002h
movx a,@dptr
mov b,a
mov 30h,b
mov dptr,#3001h
movx a,@dptr
add a,30h
mov dptr,#tab
movc a,@a+dptr
cjne a,#10,tt1
mov dptr,#3000h
movx @dptr,a
sjmp $
tt1:
jc tt2
clr c
subb a,#10
mov dptr,#3000h
movx @dptr,a
sjmp $
tt2:
add a,#10
mov dptr,#3000h
movx @dptr,a
sjmp $
tab:
db 00h,01h,04h,09h,10h,19h,24h,31h,40h,51h
db 64h,79h,90h,0a9h,0c4h,0e1h
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -