微處理器 - 8085 指令集



讓我們來看看 8085 微處理器的程式設計。

指令集是執行某些任務的指令程式碼。它分為五類。

序號 指令和描述
1 控制指令

下表列出了控制指令及其含義。

2 邏輯指令

下表列出了邏輯指令及其含義。

3 分支指令

下表列出了分支指令及其含義。

4 算術指令

下表列出了算術指令及其含義。

5 資料傳送指令

下表列出了資料傳送指令及其含義。

8085 – 演示程式

現在,讓我們看看一些使用上述指令的程式演示 -

兩個 8 位數相加

編寫一個程式,將 3005H 和 3006H 記憶體位置的資料相加,並將結果儲存在 3007H 記憶體位置。

問題演示 -

(3005H) = 14H 
   (3006H) = 89H

結果 -

14H + 89H = 9DH

程式程式碼可以這樣編寫 -

LXI H 3005H   : "HL points 3005H" 
MOV A, M      : "Getting first operand" 
INX H         : "HL points 3006H" 
ADD M         : "Add second operand" 
INX H         : "HL points 3007H" 
MOV M, A      : "Store result at 3007H" 
HLT           : "Exit program" 

交換記憶體位置

編寫一個程式來交換 5000M 和 6000M 記憶體位置的資料。

LDA 5000M   : "Getting the contents at5000M location into accumulator" 
MOV B, A    : "Save the contents into B register" 
LDA 6000M   : "Getting the contents at 6000M location into accumulator" 
STA 5000M   : "Store the contents of accumulator at address 5000M" 
MOV A, B    : "Get the saved contents back into A register" 
STA 6000M   : "Store the contents of accumulator at address 6000M" 

按升序排列數字

編寫一個程式,將從記憶體地址 3000H 開始的前 10 個數字按升序排列。

MVI B, 09         :"Initialize counter"      
START             :"LXI H, 3000H: Initialize memory pointer" 
MVI C, 09H        :"Initialize counter 2" 
BACK: MOV A, M    :"Get the number" 
INX H             :"Increment memory pointer" 
CMP M             :"Compare number with next number" 
JC SKIP           :"If less, don’t interchange" 
JZ SKIP           :"If equal, don’t interchange" 
MOV D, M 
MOV M, A 
DCX H 
MOV M, D 
INX H             :"Interchange two numbers" 
SKIP:DCR C        :"Decrement counter 2" 
JNZ BACK          :"If not zero, repeat" 
DCR B             :"Decrement counter 1" 
JNZ START 
HLT               :"Terminate program execution" 
廣告