8085 微處理器中將 2 個從鍵盤輸入的數字相加的程式


我們編寫一個 8085 組合語言程式,從鍵盤輸入兩個 2 位十六進位制數,然後將結果加起來並輸出到地址欄位。

FILE NAME ADD2NUM.ASM
ORG C000H
CURAD: EQU FFF7H
UPDAD: EQU 06BCH
CLEAR: EQU 044AH
GTHEX: EQU 052FH
MVI A, 0EH
SIM
EI ; Unmask RST5.5 and enable interrupts
MVI B, 01
CALL GTHEX ; Input a 2 digit number and display in data field
MOV A, E
STA C100H ; Store the 2-digit hex number in C100H
MVI B, 01
CALL GTHEX ; Input a 2 digit number and display in data field
LDA C100H
ADD E
STA CURAD ; Add the two numbers and store in CURAD
JNC SKIP
MVI A, 01
STA CURAD+1 ; If Carry =1, store 1 in CURAD+1
SKIP: CALL CLEAR ; Blank the entire display
CALL UPDAD ; Display sum in address field.
HLT

 

更新時間: 2019 年 7 月 30 日

714 次瀏覽

啟動您的事業

透過完成課程獲得認證

開始
廣告