17.05.2015 Views

~ National ~ Semiconductor - Al Kossow's Bitsavers

~ National ~ Semiconductor - Al Kossow's Bitsavers

~ National ~ Semiconductor - Al Kossow's Bitsavers

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6.0 Instruction Set Reference (Continued)<br />

RET Unconditional Return<br />

Syntax<br />

RET<br />

{g (,rf))<br />

Affected Flags<br />

If rf= 1 then N, Z, C, and V<br />

Description<br />

Unconditionally returns control to the last instruction address<br />

pushed onto the internal Address Stack by popping<br />

that address into the Program Counter. The unconditional<br />

return instruction also has two optional operands, g and rf.<br />

The value of g determines if the Global Interrupt Enable bit<br />

[GIE] is left unchanged (g=O), restored from the Address<br />

Stack (g= 1), set (g=2), or cleared (g=3). If the g operand<br />

is omitted then g = 0 is assumed. The second optional operand,<br />

rf, determines if the ALU flags and register bank selections<br />

are left unchanged (rf=O), or restored from the Address<br />

Stack (rf= 1). If the rf operand is omitted then rf=O is<br />

assumed.<br />

Example<br />

Return from an interrupt.<br />

RET 1,1 ;Restore environment & return<br />

Instruction Format<br />

11 I 0 I 1 I ~~;o~~ I 1 I 1 11 I g I rf 1 0 I 0 I 0 I 0 1<br />

15 6! 4 3 0<br />

T-states<br />

2<br />

Bus Timing<br />

Figure 7<br />

Operation<br />

OO-GIE not affected<br />

01-Restore GIE<br />

10-SetGIE<br />

11-Clear GIE<br />

Case g of<br />

0: leave [GIE] unaffected, (default)<br />

1: restore [GIE] from Address Stack<br />

2: set [GIE]<br />

3: clear [GIE]<br />

End case<br />

If rf= 1 then<br />

restore ALU flags from Address Stack<br />

restore register bank selection from Address Stack<br />

End if<br />

Address Stack ---+ PC<br />

ROT<br />

Syntax<br />

ROT<br />

Rotate<br />

Rsd, b<br />

Affected Flags<br />

N,Z,C<br />

Description<br />

-register<br />

Rotates the contents of the register Rsd b bits to the right<br />

and places the result back into that register. The bits that<br />

are shifted out of the LSB are shifted back into the MSB,<br />

(and copied into the Carry flag). The value b may specify<br />

from 0 to 7 bit rotates.<br />

Example<br />

Add 3 to the Address Stack Pointer contained in the Internal<br />

Stack Pointer register (iSP), R30.<br />

MOVE ISP, R8 ;get (iSP)<br />

ROT R8, 4 ;shift [ASP] to low order nibble<br />

ADD 3, R8 ;add 3 to [ASP]<br />

ROT R8, 4 ;shift [ASP] to high order nibble<br />

MOVE R8, ISP ;store new (iSP)<br />

Instruction Format<br />

15 7<br />

T-states<br />

2<br />

Bus Timing<br />

Figure 7<br />

Operation<br />

Rsd<br />

I I<br />

Rsd<br />

4 o<br />

TL/F9336-12<br />

•<br />

2-119

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!