- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Program to find the Square of a number using a look-up table in 8085 Microprocessor
We write an 8085 assembly language program for finding the square of a single digit (0 to 9) using a look-up table for displaying a number and its square in the address field.
FILE NAME MYSQR.ASM ORG C100H X: DB 00H, 01H, 04H, 09H, 16H, 25H, 36H, 49H, 64H, 81H ORG C000H CURAD: EQU FFF7H UPDAD: EQU 06BCH IBUFF: EQU FFFFH MVI A, 0EH ; Load A with 0000 1110B SIM ; Unmask RST5.5 i.e. enable keyboard interrupt. ; The next 4 instructions check if a key is pressed. If a key is ; pressed, RST5.5 pin gets activated but does not interrupt the 8085 ; as it is in DI state. But RIM instruction execution reveals that ; RST5.5 is pending. In such a case, the loop is exited. AGAIN: DI RIM ANI 00010000B JZ AGAIN ; Stay in this loop till a key is pressed EI NOP ; RST5.5 interrupts the 8085 now. Only after NOP is ; executed, interrupt system is enabled. ; So control is transferred to RST5.5 ISS. Details of this ISS ; is discussed in a later chapter when Intel 8279 chip is discussed. ; Execution of this ISS results in location IBUFF getting loaded ; with code of key pressed. Then the control is passed on to the ; program segment shown below. LDA IBUFF CPI 0AH JNC AGAIN ; If code is >= 0AH, jump to AGAIN. LXI H, X ; Point HL to the beginning of the look up table. MOV L, A ; Load L from A. Thus, point HL to the location which ; contains the square of the number input by the user. MOV A, M ; Load A with the square of the number. MOV H, L ; Load H with the number whose square is desired. MOV L, A ; Load L with the square of the number. SHLD CURAD CALL UPDAD ; Display the number and its square. JMP AGAIN ; Jump to read the next value from the keyboard.
Advertisements