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