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
广告