Syntax: MOV destination,source
Copy the contents of the source into destination.Destionation & source size should match.Because,data registers can be accessed in byte, word or double-word sizes(If you don’t remember this data registers, you can access to our first topic from here).
- MOV register,register
- MOV register,memory
- MOV memory,register
- MOV register,constant
- MOV memory,constant
Notice: Values can not be loaded into any segment registers(Code Segment,Data Segment, Extra Segment, Stack Segment) directly.First load into a non-segment register and then move.
Syntax: ADD operand1,operand2
Adds together its two operands, storing the result in its first operand.
- ADD register,register
- ADD register,memory
- ADD memory,register
- ADD register,constant
- ADD memory,constant
Notice: It is not possible to use segment registers.
Syntax: SUB operand1,operand2
Stores in the value of its first operand the result of subtracting the value of its second operand from the value of its first operand.Combinations & notice is exactly the same as ADD instruction.
NOP instruction does nothing for one clock cycle.Most of the time it is used for timing purposes.
Example: A simple example in DEBUG environment
Interrupts processing and runs requested rotine then returns back to the current program to resume processing.
For this purpose INT performs:
- Pushes contents of FR(Flag Register) into stack.
- Clears the IF(Interrupt Flag) & TF(Trap Flag) in order to, not to take any other interrupt and present step by step execution.
- Pushes CS into stack.
- Pushes IP into stack.
- Perform the requested routine.
To return from an interrupt, stack is popped to related register and this causes a return to the instruction following the INT.Operand of INT instruction gives us the address of group of routines and value in AH register shows us a specific routine in that group.
Example: Current Date
When interrupt is executed it checks the value of AH & by combining operand & AH accesses to the desired routine.When this code is executed, the values in registers AL,CX & DX gives us current date.
If,in this same code;
- The value of AL=05,it gives us days of week of your system by number format(0 is Sunday).
- The value of CX=07DF, it gives us year of your system(2018).
- The value of DH=0B, it gives us month of your system by number format(11).
- The value of DL=06, it gives us day of month.
Example: Current Time
When this code is executed, the values in registers CX & DH gives us current time.
If,in this same code;
- The value of CH used, it gives us hour of your system.
- The value of CL used, it gives us minute of your system.
- The value of DH used, it gives us second of your system.
Notice : In order to set system date function code(value of AH) is given as 2B and registers DH, DL & CX is adjusted.
Notice:In order to set system time function code is given as 2D and registers CH, CL & DH is adjusted.