Types Assembly Statement
- An imperative statement indicates an action to be performed during the execution of the assembled statement.
- Each imperative statement typically translates into one machine instruction.
- Moreover, These are executable statements.
- So, Some example of imperative statement is given below
- Declaration statements are for reserving memory for variables.
- The syntax of declaration statement is as follow:
[Label] DS <constant>
*Label+ DC ‘<value>’
DS: stands for Declare storage, DC: stands for Declare constant.
- Also The DS statement reserves area of memory and associates name with them.
Also, Above statement reserves 10 words of memory for variable A.
- The DC statement constructs memory words containing constants.
ONE DC ‘1’
Above statement associates the name ONE with a memory word containing the value ‘1’
- So, Any assembly program can use constantly in two ways- as immediate operands, and as literals.
- Many machines support immediate operands in the machine instruction. Ex: ADD AREG, 5
- But the hypothetical machine does not support immediate operands as a part of the machine instruction. It can still handle literals.
- A literal is an operand with the syntax=’<value>’. EX: ADD AREG,=’5’
- It differs from constant because its location cannot be specified in the assembly program.
- Similarly, Assembler directives instruct the assembler to perform a certain action during the assembly program.
- So, This directive indicates that first word of a machine should be placed in the memory word with address <constant>.
- START <Constant>
- Ex: START 500
- So, The first word of the target program is stored from memory location 500 onwards.
- Moreover, This directive indicates an end of the source program.
- Also, The operand indicates an address of the instruction where the execution of program should begin.
- By default, it is first instruction of the program.
- So, END <operand 2>
- Execution control should transfer to label given in operand field.