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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.0 Instruction Set Overview (Continued)<br />

Shift and Rotate Instructions<br />

The shift and rotate instructions operate on any of the 8-bit<br />

CPU registers. The BCP supports shift left, shift right, and<br />

rotate operations. Table VIII lists the shift and rotate instructions.<br />

Comparison Instructions<br />

The BCP utilizes two comparison instructions. The CMP instruction<br />

performs a two's complement subtraction between<br />

a register and immediate data. The BIT instruction tests selected<br />

bits in a register by ANDing it with immediate data.<br />

Neither instruction stores its results, only the ALU flags are<br />

affected. Table IX lists both of the comparison instructions.<br />

Program Flow Instructions<br />

The BCP has a wide array of program flow instructions: unconditional<br />

jumps, calls and returns; conditional jumps,<br />

calls, and returns; relative or absolute instruction addressing<br />

on jumps and calls; a specialized register field decoding<br />

jump; and software interrupt capabilities. These instructions<br />

redirect program flow by changing the Program Counter.<br />

The unconditional jump instructions support both relative instruction<br />

addressing, the (JuMP instruction), and absolute<br />

instruction addressing, (the Long JuMP instruction), using<br />

the following addressing modes: Immediate, Register, Absolute,<br />

and Indexed. Table X lists the unconditional jump instructions<br />

and their variations.<br />

The conditional jump instructions support both relative instruction<br />

addressing and absolute instruction addressing using<br />

the Immediate and Absolute addressing modes. The<br />

conditional relative jump instruction tests flags in the Condition<br />

Code Register, {CCR J. and the Transceiver Status<br />

Register, (TSR). Two possible syntaxes are supported for<br />

the conditional relative jump instruction; see Table XI.<br />

Table XII lists the various flags "f" that the conditional JMP<br />

instruction can test and Table XII I lists the various conditions<br />

"cc" that the Jcc instruction can test for. Keep in<br />

TABLE VIII. Shift and Rotate Instructions<br />

Syntax I nstruction Operation Addressing Mode<br />

SHL Rsd,b Register<br />

SHR<br />

Rsd,b<br />

~ i i i i i i i III<br />

~o<br />

Rod<br />

i i i i i i i<br />

o~ •<br />

Rod<br />

~<br />

Register<br />

4<br />

i i i i i i i<br />

ROT Rsd,b III<br />

~<br />

Register<br />

Note: "b" = the number of bit shifts/rotates to perform.<br />

Rod<br />

Syntax<br />

TABLE IX. Comparison Instructions<br />

Instruction Operation Addressing Mode<br />

CMP rs, n register - n Limited Register<br />

BIT rs, n register & n Limited Register<br />

Note: & = logical AND operation<br />

TABLE X. Unconditional Jump Instructions<br />

Syntax Instruction Operation Operand Range Addressing Mode<br />

JMP n PC + n (sign extended) ~ PC -128, +127 Immediate<br />

JMP Rs PC + Rs (sign extended) ~ PC -128, +127 Register<br />

LJMP nn nn~PC O,64k Absolute<br />

LJMP [lrl Ir~PC O,64k Indexed<br />

Note: PC = Program Counter; contents initially points to instruction following jump.<br />

2-94

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

Saved successfully!

Ooh no, something went wrong!