The assembler programs are composed of:
- Instructions: generate machine instruction
or opcode, number of bits allocated to the execution of a particular statement
or operands, located in a memory location. They canbe variables, constants or identifiers.
- Pseudoistruzioni or directives: are commands to the assembler
-> Definition of variables
-> Definition of constants
-> Management of segments of code
Addressing modes. the data can be contained in registers, memory, peripheral I / 0, in the instruction:
- Register, the register specified in education is to be usedas an operand
- Immediate, since education is specified for use withoperating
- Direct, education is the identifier specified in a variable in memory to be used as an operand
- Register Indirect, the operand is contained in an index register (BX, DI, SI, BP)
- Relative Base, the operand address is calculated by the sum of an index register with a constant specified in education
- Direct Indexed, the address is obtained by adding the contents of DI or SI with the contents of a variable which acts as offset
- Indexed Base, the address is obtained by summing the contents of DI or SI with the offset contained in BX or BP.
MOV does not allow some combinations of operands:
- MOV MEMORY, MEMORY (should go through the registers)
- MOV SEGMENT REGISTER, REGISTER SEGMENT(should pass through the stack)
- MOV SEGMENT REGISTER, IMMEDIATE (pass throughregisters)
- MOV AL, AX (use the CBW)
The SHR instruction is equivalent to a division by 2 ^ n.(for unsigned numbers, or SAR).
The SHL instruction is equivalent to a multiplication by 2 ^ n. (for unsigned numbers, otherwise SAL).
JMP supports two types of unconditional jump:
or Short, the address is stored as the difference between the start and finish in a single byte
or Near, the address is stored as the difference between the start and finish in a word
or Far, the address is on two words: it is thenmemorized the address.
- Indirect, the address is not shown but is given the pointer to the location in which to find the destination address
CALL behaves differently depending on the procedurecall:
- if the called procedure is type NEAR, charging only the content dell'Instruction stack pointer (IP), ie the offset address of the next;
- if the called procedure is type FAR, the stack beforeloading the contents of the CS segment register and thenlog the contents of IP.
The procedures communicate with each other via the passage of parameters that can be made:
- by value, the procedure will be sent a copy of the parameter
- by reference, is sent to the address on which to act