Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Assembler Directives
There are some instructions in the assembly language program which are not a part of processor instruction set. These instructions are instructions to the assembler, linker, and loader. These are referred to as pseudo-operations or as assembler directives. The assembler directives enable we to control the way in which a program assembles and lists. They act during the assembly of a program and do not generate any executable machine code.
ASSUME :
The ASSUME directive assigns a logical segment to a physical segment at any given time. That is, the ASSUME directive tells the assembler what addresses will be in the segment registers at execution time. Example : ASSUME CS : code, DS : Data, SS : stack.
NAME : The name directive is used at the start of a source program to give specific names to each assembly module. OFFSET : It is an operator which tells the assembler to determine the offset or displacement of a named data item (variable) from the start of the segment which contains it.
TYPE : It is an operator which tells assembler to determine the type of specified variable.
Assembler determines the type of specified variable in number of bytes. For byte type variable the assembler gives a value of 1. For word type variable the assembler gives a value of 2 and for double word type variable the assembler gives a value of 4.
Accessing a Procedure and Data from Another Assembly Module As mentioned earlier, usually a large program is divided into a series of modules. Each module is individually written, assembled, and tested. The object code files for the modules are then linked together to generate a linked file or executable file. In order for a linker to be able to access data or a procedure in another assembly module correctly we have to use two assembly language directives : PUBLIC and EXTRN In the module where a variable or procedure is declared we must use the PUBLIC directive to let the linker know that the variable or procedure can be accessed from other modules.
Assembly Language Programming Steps Involved in Programming : Specifying the problem :- find out which task is to be performed. Designing the problem- solution :- program logic Coding : Debugging : To write a program, programmer should know How to develop program logic? How to tell the program to the processor? How to code the program? How to test the program?
Assembly Language Programming Cont.. Flow Chart : To develop the programming logic programmer has to write down various actions which are to be performed in proper sequence. The flow chart is a graphical tool that allows programmer to represent various actions which are to be performed. The graphical representation is very useful for clear understanding of the programming logic.
Assembly Language Programming Tips Cont In this section we will see some tips regarding this What is an optimum solution ? :
The optimum solution is the solution which takes minimum memory space for the program and minimum time for the execution of a task. When we say memory space for the program we consider space for program storage (program length), space for data storage and space used by the stack.
Assembling Process
assembler translates a source file that was created using the editor into machine language such as binary or object code. The assembler reads the source file of our program from the disk where we saved it after editing. An assembler usually reads our source file more than once.
Linking Process
A linker is a program used to join together several object files into one large object file. When writing large programs, it is usually much more efficient to divide the large program into smaller modules. Each module can be individually written, tested and debugged. When all the module work, they can be linked together to form a large functioning program.
Debugging Process
A debugger is a program which allows as to load our object code program into system memory, execute the program, and debug it.