Basic Structure of Assembly Language Program YASH PAL, March 19, 2026March 19, 2026 Basic Structure of Assembly Language Program – A program is a collection of instructions written in a sequence to perform a specific task. A basic assembly language program can have two types of structure. Sequential Program Iterative Program Sequential Program Structure The instructions of a sequential program are executed one after another without any change in the sequence. Meaning that there is no branch instruction in the program. The program counter register is continuously incrementing until the instruction HLT is executed. Let’s write a sequential assembly language program to perform the following operations: Load the number 53H in register B and 58H in register C. Add the contents of register B and register C. Save the sum at memory location XX70H. Solution: A flowchart of the given problem is shown in the figure below. Flowchart for a sequential program MemoryAddressHexCodeInstructionOpcodeInstructionOperandCommentsXX00HXX01H0653MMB, 53HLoad 53H to register BXX02HXX03H0E58MMC, 58HLoad 58H to register CXX04H78MOVA, BCopy the contents of register B to AXX05H81ADDCAdd the contents of register C to AXX06HXX07HXX08H3270XXSTAXX70HStore the result stored in register A to memory location XX70HXX09H76HLTStop the executionAssembly Language Program Since there is no repeated task or instruction, this is an example of a sequential program. Iterative Program Structure The program in which a segment of the program is repeated to complete a task or to solve a typical problem is known as an iterative program. An iterative program structure can be further classified into two groups: Unconditional Conditional Unconditional Iterative Program – In this type of program, the segment is repeated without any condition. Conditional Iterative Program – In conditional iterative programs, the segment of the program is repeated after checking the condition. If the condition is satisfied, the repetition is done else not. Let’s write an assembly language program to continuously read the status of eight switches connected at the input port. Input port address is 01H. Stop the execution of the program if all the input switches are OFF(0). Solution: Reading operation, in this problem, is a task to be repeated until all the input switches are OFF(0). It means this is an example of a conditional iterative program. The flow chart for this is shown in the figure below. Flowchart for an iterative program MemoryAddressHexCodeLabelInstructionOpcodeInstructionOperandCommentsXX00HDBSRTIN01HRead the input port with the address 01H.XX01H01IN01HRead the input port with the address 01H.XX02HFECPI00HCompare the input data from input port with the immediate data 00H.XX03H00CPI00HCompare the input data from the input port with the immediate data 00H.XX04HC2JNZSRTIf the zero flag Z = 0, jump to the label SRT; else execute the next instruction.XX05H00JNZSRTIf the zero flag Z = 0, jump to the label SRT; else execute the next instruction.XX06HXXJNZSRTIf the zero flag Z = 0, jump to the label SRT else execute the next instruction.XX07H76HLTStop the execution.Assembly Language Program engineering subjects Microprocessor microprocessor