Types: Assembly Statements
- An imperative statement indicates an action to be performed during the execution of the assembled statement.
- So, Each imperative statement typically translates into one machine instruction.
- Moreover, These are executable statements.
- Some example of imperative statement are 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.
- Moreover, The DS statement reserves area of memory and associates name with them.
A DS 10
Above statement reserves 10 words of memory for variable A.
- So, 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’
- Any assembly program can use constantly in two ways- as immediate operands, and as literals.
- So, Many machines support immediate operands in a 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.
- Moreover, A literal is an operand with the syntax=’<value>’. EX: ADD AREG,=’5’
- It differs from constant because its location cannot be specified in an assembly program.
- Similarly, Assembler directives instruct the assembler to perform a certain action during the assembly program.
- 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.
- This directive indicates an end of the source program.
- So, The operand indicates an address of the instruction where the execution of program should begin.
- Also, By default, it is first instruction of the program.
- END <operand 2>
- Execution control should transfer to label given in operand field.