8085微处理器中的十进制递减计数器程序

我们用8085汇编语言编写一个程序,以实现十进制递减计数器(从99到00)。该程序必须在以下条件下运行。

  • 我们向累加器加载99。

  • 在累加器中显示累加器中的计数值。RST5.5处于未屏蔽状态,并且中断系统被启用。

该程序如下:

FILE NAME DOWNCNTR.ASM
ORG C000H
CURDT: EQU FFF9H
UPDDT: EQU 06D3H
RDKBD: EQU 0634H
MVI A, 99H ; Initialize A with 99.
REP: STA CURDT ; Store A value in CURDT.
CALL UPDDT ; Display contents of CURDT in data field.
MVI A, 00001110B
SIM ; Unmask RST5.5
EI ; Enable Interrupt system
CALL RDKBD ; Wait till a key is pressed and load
; the key code in Accumulator, but ignore it.
LDA CURDT ; Reload A from location CURDT.
ADI 99H
DAA ; Decrement A in decimal notation by
; adding 99, which is 10's complement of 01.
JMP REP ; Jump to REP to display the next count.