Executing Assembly Language Program:
Let us define a program statement as ‘write an Executing Assembly Language Program to add two numbers’. The three tasks are involved in this program :
Load two hex numbers
Add numbers and
Store the result in the memory
These tasks can be symbolically presented as flow chart, as shown in the Fig. 3.6.
Assembly Language Program to Machine Language Program:
Once the assembly language program is ready, it is necessary to convert it in the machine language program. It is possible to do this by referring the proper hex code for each, assembly instruction from the 8085 instruction set manual. This process is known as hand assembly and the resulted machine language program is also known as hex code. Let us see the hex code for our program.
Storing Hex Code in the Memory:
Once the hex code is ready, it has to be loaded in the memory of specially designed microprocessor system (Microprocessor training kit) for execution. To perform this task we should know the address range of read/write memory in the system.
Let us assume that the read/write memory ranges from 2000H to 22FFH. The microprocessor training kit has keypad to enter the hex code, in the memory. It provides a special routines (monitor program) to enter a hex code byte by byte and execute the program. Typical steps for storing hex code in the memory from address from address 2000H are as follows :
- Reset the microprocessor system by pressing the RESET key.
- Enter into store mode by pressing SET key.
- Enter the address of the memory 2000H, where the first hex code (starting address of the program) is to be stored using hex keys.
- Enter the hex code using hex keys.
- Increment the memory address by 1 using INC key.
- Repeat steps 4 and 5 until the last hex code.
Executing the Program:
The microprocessor training kit provides a procedure to execute the program. To activate the procedure we have to enter the starting address of the program (2000H in our example). To enter this address we have to go into execute mode by pressing GO key and enter the starting address using hex keys.
Once the starting address is entered, the program can be executed by pressing EXECUTE key. The EXECUTE key procedure loads the starting address of our program, 2000H into the program counter and program control is transferred from monitor program to our program.
After this microprocessor reads one hex code at a time, and when it fetches the complete instruction, it executes that instruction. Then it fetches the next instruction and this process continues until the last instruction in the program is executed.