• 沒有找到結果。

Instructions: MOV, DJNZ, RR, SJMP instruction format

N/A
N/A
Protected

Academic year: 2022

Share "Instructions: MOV, DJNZ, RR, SJMP instruction format"

Copied!
7
0
0

加載中.... (立即查看全文)

全文

(1)

Instructions: MOV, DJNZ, RR, SJMP

Department of Computer Science and Information Engineering, Chaoyang University of Technology

朝陽科技大學資工系

Speaker: Fuw-Yi Yang

楊伏夷

(2)

Instructions: MOV, DJNZ, RR, SJMP instruction format

An Assembly language instruction consists of 4 fields:

[label:] mnemonic [operands] [;comment]

Top: MOV A, #00H ; move immediate data to register A MOV P0, A

Brackets ([ ], should not be typed in) indicate that a field is optional, and not all lines have them.

(3)

Instructions: MOV, DJNZ, RR, SJMP assembler directives

Some widely used directives are:

ORG (origin)

EQU (equate), Count EQU 25 MOV R3, #Count

DB (define byte), DATA1: DB 28 ; decimal data DATA2: DB 0FEH; Hex data

DATA3: DB 00110011B; Binary data

DATA4: DB “My name is yang” ; ASCII codes END

(4)

Instructions: MOV, DJNZ, RR, SJMP

MOV dest-byte, source-byte

1. MOV A, #data MOV A, #25H ; data is 25

2. MOV A, Rn (n = 0…7) MOV A, R3 ; data in register R3 3. MOV A, direct MOV A, 30H ; data in address 30H 4. MOV A, @Ri (i = 0 or 1) MOV A, @R0 ; data pointed by R0 5. MOV Rn, A 6. MOV direct, A 7. MOV @Ri, A 8. MOV Rn, #immediate 9. MOV Rn, A 10. MOV Rn, direct 11. MOV direct, #data 12. MOV direct, @Ri

(5)

Instructions: MOV, DJNZ, RR, SJMP DJNZ byte, target

1. DJNZ Rn (n = 0…7), target DJNZ R3, Here

Example: Count from 1 to 20 and send the count to P1.

CLR A ; A = 0

MOV R2, #20 ; R2 = 20 counter Back: INC A

MOV P1, A

DJNZ R2, BACK ; repeat if R2 not = zero

(6)

Instructions: MOV, DJNZ, RR, SJMP RR A

This rotates the bits of register A right.

Example:

MOV A, #01100110B ; A = 01100110 RR A ; A = 00110011 RR A ; A = 10011001

(7)

Instructions: MOV, DJNZ, RR, SJMP SJMP 8-bit address

Transfer control unconditionally to a new address.

Example: Location Object code

0100 ORG 100H 0100 803E SJMP OVER 0140 ORG 140 H 0140 7A0A OVER: MOV R2, #10 0142 7B64 AGAIN: MOV R3, #100 0144 00 BACK: NOP

0145 00 NOP

參考文獻

相關文件

Department of Computer Science and Information

Department of Computer Science and Information

Chaoyang University of Technology.. 勤學

Do Sang Kim, Department of Applied Mathematics, Pukyong National University, Korea.. Zheng Peng, School of Mathematics and Computer Science, Fuzhou

Professor of Computer Science and Information Engineering National Chung Cheng University. Chair

隨著科技的進步,展覽場的導覽系統已從過去導遊、磁帶機或 CD 播放 器講解的時代轉換成行動導覽的時代。目前行動導覽方式大都以 RFID 或 QR

2 Department of Materials Science and Engineering, National Chung Hsing University, Taichung, Taiwan.. 3 Department of Materials Science and Engineering, National Tsing Hua

Assistant Professor, Industrial Engineering and Management Chaoyang University of Technology. Chen Siao Gong JULY 13 , 2009 Chen