Академический Документы
Профессиональный Документы
Культура Документы
Ab br eviatio ns
Carry Flag Over-flow flag Sign Flag Zero Flag Parity Flag Instruction Pointer CF OF SF ZF PF IP
6-2
5-bit Opcode 47
19-bit operand
Operand 2 36 25 21 19 5
Operand 1 1 0
# default & $ ! @
6-3
Logical instructions............................................................................ 7
AND OR XOR SHL SHR ROL ROR NOT Bit-wise And............................................................................................ 7 Bit-wise OR ............................................................................................. 8 Bit-wise XOR .......................................................................................... 8 Shift a register left 1-bit........................................................................... 9 Shift a register right 1-bit......................................................................... 9 rotate a register left 1-bit........................................................................ 10 rotate a register right 1-bit ..................................................................... 11 Ones compliment negation ................................................................... 11
Loop Instructions.............................................................................. 15
LOOZ Loop until zero....................................................................................... 15
Miscellaneous instructions.............................................................. 17
NOP No operation .......................................................................................... 17
6-4
ADD
Opcode Format Description
Addition
10000 ADD Register operand1, Register operand2 Adds two registers. Result modifies Operand1. ADD instruction performs integer addition. It evaluates the results for both signed and unsigned integer operands and sets the CF and OF flags to indicate a carry in the signed or unsigned result, respectively. The SF indicates the sign of the signed result. operand1 operand1+ operand2 Immediate and register direct ZF, OF, SF and PF are set according to the result.
SUB
Opcode Format Description
Subtraction
10001 SUB Register operand1, Register operand2 Subtracts the register 2 from register 1. Result modifies the Register1. SUB instruction performs integer subtraction. It evaluates the results for both signed and unsigned integer operands and sets the CF and OF to indicate a carry in the signed or unsigned result, respectively. The SF indicates the sign of the signed result. operand1 operand1 operand2 Immediate and register direct ZF, OF, SF, CF and PF are set according to the result.
6-5
MUL
Opcode Format Description
Signed multiplication
11011 MUL operand1 (8-bit), operand2 (8-bit) Performs signed multiplication on lower 8-bits of operand 1 and operand 2. Mul instruction produces a 16bit result. Both operand 1 and operand 2 are registers. operand1 (16-bit) operand1 * operand2 (8 LSBs) (8 LSBs)
Operation
Immediate and register direct ZF, SF and PF are set according the product. OF and CF is cleared, as no overflow occurs in this situation and no carry considered.
DIV
Opcode Format Description
Signed division
11100 DIV operand1, operand2 Divides operand 1 by operand2. Div instruction produces an integer output. Both operand 1 and operand 2 are registers. operand 1 operand 1 / operand 2 Immediate and register direct ZF, SF and PF are set according the product. OF and CF is cleared, as no overflow occurs in this situation and no carry considered.
6-6
INC
Opcode Format Description
Increment a register by 1
10101 INC operand Adds 1 to the register specified. Evaluates for both signed and unsigned operands. operand operand +1 Implied register direct the CF is not affected. The OF, SF, ZF and PF are set according to the result.
Logical instructions
AND
Opcode Format Description
Bit-wise And
10010 AND operand1, operand1 Performs bit wise AND operation on o the specified two registers, operand 1 and operand2. Each bit of the result is set to 1 if both corresponding bits of the operands are 1; otherwise, it is set to 0. Result replaces the operand 1. operand1 operand1 AND operand2 Implied register direct OF and CF are cleared; SF, ZF and PF are set according to the result.
6-7
OR
Opcode Format Description
Bit-wise OR
10011 OR operand1, operand2 Performs bit wise OR operation on the specified two registers, operand 1 and operand 2. Each bit of the result is set to 0 if both corresponding bits of the operands are 0; otherwise, it is set to 1. Result replaces the register specified as operand 1. operand1 operand1 OR operand2 Immediate or register direct OF and CF are cleared; SF, ZF and PF are set according to the result.
XOR
Opcode Format Description
Bit-wise XOR
10100 XOR operand1, operand2 Performs bit wise XOR operation on the specified registers, operand 1 and operand 2. Each bit of the result is set to 0 if both corresponding bits of the operands are 1 or if both corresponding bits of the operands are 0; otherwise, it is set to 1. Result replaces the register specified as operand 1. operand1 operand1 XOR operand2 Immediate or register direct OF and CF are cleared; SF, ZF and PF are set according to the result.
6-8
SHL
Opcode Format Description
Operation
SHR
Opcode Format Description
Operation
6-9
ROL
Opcode Format Description
Operation
6 - 10
ROR
Opcode Format Description
Operation
NOT
Opcode Format Description
6 - 11
JC
Opcode Format Description
JOF
Opcode Format Description
6 - 12
JS
Opcode Format Description
Operation AM
Flags affected
JP
Opcode Format Description
6 - 13
JZ
Opcode Format Description
Operation AM
Flags affected
Unconditional branch
JUMP
Opcode Format
Jump
01111 JUMP {Signed offset (IP relative)}
Description
Transfers the program control to a different point of the instruction stream. The operand specified the signed offset being jumped to. This operand is an immediate signed offset.
IP IP + operand IP relative addressing is applied in the address calculation. none
6 - 14
Loop Instructions
LOOZ
Opcode Format Description
Operation
Count Count 1 IF Count =0 Loop termination ELSE IP IP + operand END IF IP relative addressing is applied in the address calculation. none
AM
Flags affected
6 - 15
CALL
Opcode Format Description
Call procedure
01010 CALL {Immediate address} Saves IP in the implied register and branches to the procedure (called procedure) specified by the operand. This operand is an immediate value. When executing a CALL, the processor pushes the value of the IP register on to the implied register (For use latter as a returninstruction pointer). The processor then branches to the address specified with instruction. 29th register of the register bank is reserved to hold the return address.
Operation
implied register (29th register) IP IP IP + Operand Immediate operand is used as the jumping location none
AM Flags affected
RETURN
Opcode Format Description
6 - 16
Miscellaneous instructions
NOP
Opcode Format Description Flags affected
No operation
01110 NOP Performs no operation. Takes up space in the instruction stream but does not affect the context, except IP. none
6 - 17
LOAD
Opcode Format Description 01100 LOAD AM operand1, operand2 Immediate Addressing Copy the 16-bit immediate source operand (operand 2) to the destination register (operand 1). Direct Addressing Copy the contents of the source (operand2) address (of memory) to the destination register (operand1). Register Indirect Addressing Memory address is found by accessing the register bank for the source register (operand 2). Content of the memory location is copied to the destination register (operand 1). Indexed Addressing Base register (operand 2) and the implied index register is added to make the address of the source operand. Contents of the memory address then copied to the destination register (operand 1). 30th of the register bank is the implied Index register Operation Immediate Addressing
Register bank (operand 1) 16-bit immediate Operand 2
Direct Addressing
Register bank (operand 1) memory (operand 2)
Indexed Addressing
Register bank memory {register bank (operand2) + register bank (implied Index register)}
6 - 18
STORE
Opcode Format Description 01101 STORE AM operand1, operand2 Direct Addressing Copy the contents of the source register (operand2) to the destination memory address (operand1). Indirect Addressing Copy the contents of the source register (operand2) to the destination memory address found at operand1 in memory. Register Direct Addressing Copy the contents of the source register (operand2) to the destination register (operand 1). Register Indirect Addressing Copy the contents of the source register (operand2) to the destination memory address found by accessing the register bank (operand 1). Indexed Addressing Base register (operand 2) and the implied index register are added to make the destination memory address. Contents of the memory address then copied to the destination register (operand 1). 30th of the register bank is the implied Index register Operation Direct Addressing
Register bank (operand 1) memory (operand 2)
Indirect Addressing
Register bank (operand 1) memory {memory (operand2)}
Indexed Addressing
Register bank memory {register bank (operand2) + (operand1) register bank (implied Index register)}