Top Banner
Branch and Input   Output instructions
29

Branch and Input –Output instructions

Apr 07, 2018

Download

Documents

anju_praju
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 1/29

Branch and Input – Output

instructions

Page 2: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 2/29

Branch instruction

Page 3: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 3/29

Description

1) B-Branch Unconditionally

• Syntax- B pma [, ind [,ARn]]

• Execution :pma PC

Modify (current AR) and (ARP) as specified 

• Example B 191,*+,AR1

• The value 191 is loaded into the program counter, and the program

continues to execute from that location. The current auxiliary

register is incremented by 1, and ARP is set to point to auxiliary

register 1 (AR1).

Page 4: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 4/29

2) BACC -Branch to Location Specified by Accumulator

• Syntax- BACC

• Example: BACC ;(ACC contains the value 191)

• The value 191 is loaded into the program counter, and the

program continues to execute from that location.

Page 5: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 5/29

3)BANZ- Branch on Auxiliary Register Not Zero

• Syntax -BANZ pma [, ind [, Arn]]

Example: BANZ PGM0 ;(PGM0 labels program address 0)

Page 6: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 6/29

4)BCND Branch Conditionally

• Syntax -BCND pma, cond1 [,cond2] [,...]

• Execution If cond1 AND cond2 AND ...

Then pma PCElse increment PC

• Example BCND PGM191,LEQ,C

If the accumulator contents are less than or equal to zero and the

carry bit is set, program address 191 is loaded into the programcounter, and the program continues to execute from that

location. If these conditions do not hold, execution continues

from location PC + 2.

Page 7: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 7/29

5) CALA-Call Subroutine at Location Specified by Accumulator

• Syntax- CALA

• Execution -PC + 1 TOS

ACC(15:0) PCExample :CALA 

Page 8: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 8/29

6) CALL -Call Unconditionally

• Syntax -CALL pma [, ind [, Arn]]

• Execution- PC + 2 TOS

Pma PC• Example- CALL 191,*+,AR0

Page 9: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 9/29

7) CC-Call Conditionally

• Syntax -CC pma, cond1 [,cond2] [,...]

• Execution -If cond1 AND cond2 AND ...

•Then PC + 2 TOS

• Pma PC

• Else Increment PC

• Example CC PGM191,LEQ,C

• If the accumulator contents are less than or equal to zero andthe carry bit is set, 0BFh (191) is loaded into the program

counter, and the program continues to execute from that

location. If the conditions are not met, execution continues at

the instruction following the CC instruction.

Page 10: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 10/29

8) INTR- Software Interrupt

• Syntax- INTR K

• Execution (PC) + 1 stack 

corresponding interrupt vector location PC

• Example: INTR 3

;PC + 1 is pushed onto the stack.

;Then control is passed to program

;memory location 6h.

Page 11: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 11/29

9)NMI-Nonmaskable Interrupt

• Syntax- NMI

• Execution (PC) + 1 stack 

24h PC1 INTM

• Example: NMI

;PC + 1 is pushed onto the stack, and then

;control is passed to program memory location

;24h.

Page 12: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 12/29

10)RET-Return From Subroutine

• Syntax – RET

• Execution -(TOS) PC

Pop stack one level• Example: RET

Page 13: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 13/29

11) RETC- Return Conditionally

• Syntax -RETC cond1 [, cond2] [,...]

• Execution -If cond1 AND cond2 AND ...

(TOS) PCPop stack one level

Else, continue

• Example: RETC GEQ,NOV ;A return is executed if the

• ;accumulator content is positive• ;or zero and if the OV (overflow)

• ;-bit is zero.

Page 14: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 14/29

12) TRAP-software interrupt

• Syntax- TRAP

• Execution -(PC) + 1 stack 

• 22h PC

• Example TRAP

• ;PC + 1 is pushed onto the stack, and then ;control is

passed to program memory location

• ;22h

Page 15: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 15/29

I/O and Memory instructions

Page 16: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 16/29

1) BLDD- Block Move From Data Memory to DataMemory

• Syntax- General syntax: BLDD source, destination

BLDD #lk, dma Direct with long immediate source• BLDD #lk, ind [, ARn] Indirect with long immediate

source

• BLDD dma, #lk Direct with long immediate destination

• BLDD ind, #lk [, ARn] Indirect with long immediatedestination

Page 17: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 17/29

Page 18: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 18/29

Page 19: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 19/29

2)BLPD-Block Move From Program Memory to

Data Memory.

• Syntax General syntax: BLPD source, destination

• BLPD #pma, dma Direct with long immediate source

• BLPD #pma, ind [, ARn] Indirect with long

immediate source

Page 20: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 20/29

Page 21: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 21/29

Page 22: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 22/29

3) DMOV-Data Move in Data Memory

• Syntax- DMOV dma Direct addressing

DMOV ind [, ARn] Indirect addressing

• Execution- Increment PC, then ...

(data-memory address) data-memory address + 1

Page 23: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 23/29

4) IN -Input Data From Port

• Syntax -IN dma, PA Direct addressing

IN ind, PA [, ARn] Indirect addressing

• Example : IN 7,1000h

;Read in word from peripheral on

;port address 1000h. Store word in

;data memory location 307h (Dp=6)

Page 24: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 24/29

5)OUT-Output Data to Port

• Syntax- OUT dma, PA Direct addressing

OUT ind, PA [, ARn] Indirect addressing

Page 25: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 25/29

6) SPLK -Store Long-Immediate Value to Data

Memory

• Syntax -SPLK #lk, dma Direct addressing

SPLK #lk, ind [, ARn] Indirect addressing

• Execution- Increment PC, then ...

lk data-memory address

Page 26: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 26/29

7)TBLR-Table Read

• Syntax -TBLR dma Direct addressing

TBLR ind [, ARn] Indirect addressing

Page 27: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 27/29

Page 28: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 28/29

8) TBLW- Table Write

• Syntax- TBLW dma Direct addressing

TBLW ind [, ARn] Indirect addressing

Page 29: Branch and Input –Output instructions

8/3/2019 Branch and Input –Output instructions

http://slidepdf.com/reader/full/branch-and-input-output-instructions 29/29