Assembly Language Programming
Assembly language programming for the 8085 involves writing programs using mnemonics that directly correspond to machine instructions. It teaches fundamental concepts of low-level programming, memory management, and hardware interaction.
Program Structure
An 8085 assembly program specifies the starting address (ORG directive), contains instructions in sequence, and ends with HLT. The assembler converts mnemonics to machine code. Labels mark addresses for jumps. Comments document the code.
Data Transfer Programs
Basic programs move data between registers and memory. Example: transfer a byte from one memory location to another using LDA (load accumulator from memory) and STA (store accumulator to memory). Block transfer uses loops with register pairs as pointers.
Arithmetic Programs
Common programs include addition of two 8-bit numbers (ADD, with carry using ADC), subtraction (SUB, SBB), multiplication (repeated addition), division (repeated subtraction), and BCD arithmetic (using DAA — Decimal Adjust Accumulator).
Logical and Bit Manipulation
Logical instructions (ANA, ORA, XRA) perform bitwise operations. Rotate instructions (RLC, RRC, RAL, RAR) shift bits. Applications include masking (isolating specific bits), setting/clearing flags, and parity checking.
Branching and Loops
Conditional jumps (JZ, JNZ, JC, JNC) enable decision-making based on flags. Loops use a counter register (DCR + JNZ). Nested loops multiply the iteration count. Delay routines use counted loops for timing.
Subroutines and Stack
Subroutines are reusable code blocks called with CALL and returning with RET. The stack stores return addresses and can save/restore registers (PUSH, POP). The stack pointer (SP) points to the top of the stack, which grows downward in memory.
I/O Programming
I/O instructions (IN port, OUT port) transfer data between the accumulator and peripheral devices. Memory-mapped I/O treats device registers as memory addresses. Programs for interfacing with displays, keyboards, and ADC/DAC converters demonstrate practical I/O programming.
Summary
Assembly language programming develops understanding of how software interacts with hardware at the lowest level. Skills in writing, debugging, and optimising assembly programs form the foundation for systems programming.