Technocrat

  • Home
Showing posts with label 8085. Show all posts
Showing posts with label 8085. Show all posts

Friday, November 21, 2014

8085 Programming : store the nos in a memory loc. In the reverse order in another memory location

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming




               MVI C, 0AH  ; Initialize counter  




               LXI H, 2200H  ; Initialize source memory pointer  




               LXI D, 2309H  ; Initialize destination memory pointer  




BACK:    MOV A, M  ; Get byte from source memory block  




               STAX D  ; Store byte in the destination memory block  




               INX H  ; Increment source memory pointer  




               DCX D  ; Decrement destination memory pointer   




               DCR C  ; Decrement counter   




               JNZ BACK  ; If counter  0 repeat  




               HLT ; Terminate program execution




Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming : In a set of nos add only the odd nos

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming



                 LDA 2200H  


           MOV C, A  ; Initialize counter  


           LXI H, 2201H  ; Initialize pointer  


           MVI E, 00  ; Sumlow = 0  


           MOV D, E ; Sumhigh = 0  


BACK:      MOV A, M  ; Get the number  


           ANI 01H   ; Mask Bit1 to Bit7  


           JZ SKIP                  ; Do not add if number is even  


           MOV A, E  ; Get the lower byte of sum  


                 ADD M     ; Sum = sum + data  


           MOV E, A   JNC SKIP  ; Store result in E register  


           INR D   ; Add carry to MSB of SUM  


SKIP:        INX H   ; Increment pointer  


           DCR C     ; Decrement counter  


          JNZ BACK  ; Check if counter 0 repeat  


          MOV A, E  


          STA 2300H  ; Store lower byte  


          MOV A, D  


          STA 2301H ; Store higher byte  


         HLT ; Terminate program execution  


  



Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming : In a set of nos add only the even nos

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming



            LDA 2200H  


      MOV C, A  ; Initialize counter  


            MVI B, 00H ; sum  =  0  


      LXI H, 2201H ; Initialize pointer  


BACK: MOV A, M  ; Get the number  


      ANI, 01H   ; Mask Bit1 to Bit7  


      JNZ SKIP  ; Don’t add if number is ODD  


      MOV A, B  ; Get the sum  


      ADD M  ; SUM = SUM + data  


      MOV B, A  ; Store result in B register  


SKIP:   INX  H        ; increment pointer  


      DCR C ; Decrement counter  


      JNZ BACK  ; if counter 0 repeat  


      STA 2210H ; store sum  


      HLT    ; Terminate program execution  



Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming : To find the no of 1’s in the byte

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming




            MVI B,00H   




            MVI C,08H  




            MOV A,D  




BACK: RAR  




            JNC SKIP  




            INR B  




SKIP:   DCR C  




            JNZ BACK  




            HLT  




  




Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming : Block data transfer

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming




              MVI C, 0AH  ; Initialize counter  




              LXI H, 2200H  ; Initialize source memory pointer  




              LXI D, 2300H  ; Initialize destination memory pointer  




BACK:   MOV A, M  ; Get byte from source memory block  




              STAX D  ; Store byte in the destination memory block  




              INX H  ; Increment source memory pointer  




              INX D  ; Increment destination memory pointer   




              DCR C  ; Decrement counter   




              JNZ BACK  ; If counter  0 repeat  




              HLT ; Terminate program execution  




Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming : Adding 2 Hexa-Decimal nos with carry

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming




             LDA 2200H  




             MOV C,A ; Initialize counter  




             LXI H, 2201H ; Initialize pointer  




             SUB A  ; Sum low = 0  




             MOV B,A ; Sumhigh = 0  




BACK:  ADD M ; Sum = sum + data  




             JNC SKIP  





             INR B   ; Add carry to MSB of SUM  


SKIP:    INX H   ; Increment pointer  


            DCR C ; Decrement counter  


            JNZ BACK  ; Check if counter 0 repeat  


            STA 2300H 


            MOV A,B  ; Store lower byte  


            STA 2301H  ; Store higher byte  


            HLT   ; Terminate program execution








Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming : Adding 2 Hexa-decimal nos without carry

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming





  LDA 2200


             MOV C, A ;  Initialize counter


             SUB A  ;  sum = 0


             LXI H, 2201H ;  Initialize pointer


BACK:  ADD M   ; SUM = SUM + data


             INX H  ;  increment pointer


             DCR C ;  Decrement counter


             JNZ BACK ;  if counter  0 repeat


             STA 2300H ;  store sum


             HLT







         








Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming: Adding 2 BCD nos without carry

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming







MOV A, L ; Get lower 2 digits of no. 1  




ADD E ; Add two lower digits  




DAA  ; Adjust result to valid BCD  




STA 2300H ; Store partial result  




MOV A, H ; Get most significant 2 digits of no. 2  




ADC D ; Add two most significant digits   




DAA  ; Adjust result to valid BCD   




STA 2301H ; Store partial result  




HLT ; Terminate program execution  




Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming : ADDITION OF 16BIT NUMBERS

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   




8085 Programming






ADDITION OF TWO 16BIT NUMBERS SUM 16 BITS OR MORE


Manually strore 1st 16 bit no in the memory location C050 & C051 in reverse order

Manually store 2nd 16 bit no in the memory location C052 & C053 in reverse order

Result is stored in C053, C054 & C055 in reverse order



          LHLD C050

         XCHG

         LHLD C052

         MVI C,00

         DAD D

         JNC AHEAD

         INR C



AHEAD:   SHLD C054

        MOV A,C

        STA C056

        HLT



EXAMPLE-> A645+9B23=014168

STORE-> C050=45,C051=A6,C052=23,C053=9B

Answer-> C054=68,C055=41,C056=01

// 45H,A6H,23H,9BH





Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming : 8 BIT DECIMAL SUBSTRACTION

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



 8085 Programming




If 2nd no is greater than 1st no then the answer will in 2's complement

Manually strore 1st 8 bit no in the memory location C050

Manually store 2nd 8 bit no in the memory location C051

Result is stored in C052



  LXI H,C051

  MVI A,99

  SUB M

  INR A

  DCX H

  ADD M

  DAA

  STA C052

  HLT

 EXAMPLE-> 99-48=51

 STORE-> C050=99,C051=48



OUTPUT:

C052=51





Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming: Exchange the contents of memory locations

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming





Exchange the contents of memory locations 2000H and 4000H.






Program 1:



LDA 2000H : Get the contents of memory location 2000H into accumulator



MOV B, A : Save the contents into B register



LDA 4000H : Get the contents of memory location 4000H into accumulator



STA 2000H  : Store the contents of accumulator at address 2000H



MOV A, B : Get the saved contents back into A register



STA 4000H : Store the contents of accumulator at address 4000H









Program 2:



LXI H 2000H : Initialize HL register pair as a pointer to memory location 2000H.



LXI D 4000H : Initialize DE register pair as a pointer to memory location 4000H.



MOV B, M  : Get the contents of memory location 2000H into B register.



LDAX D : Get the contents of memory location 4000H into A register.



MOV M, A : Store the contents of A register into memory location 2000H.



MOV A, B : Copy the contents of B register into accumulator.



STAX D : Store the contents of A register into memory location 4000H.



HLT : Terminate program execution.



Note: In Program 1, direct addressing instructions are used, whereas in Program 2, indirect addressing instructions are used.

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming: Store 8 bit data in Memory

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming





Program 1:




MVI A, 52H : Store 32H in the accumulator



STA 4000H : Copy accumulator contents at address 4000H



HLT : Terminate program execution




Program 2:




LXI H : Load HL with 4000H



MVI M : Store 32H in memory location pointed by HL register pair (4000H)



HLT : Terminate program execution



Note: The result of both programs will be the same. In program 1 direct addressing instruction is used, whereas in program 2 indirect addressing instruction is used.

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming: 8 BIT MULTIPLICATION: PRODUCT 16-BIT

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming








       LHLD 2501

       XCHG

       LDA 2503

       LXI H,0000

       MVI C,08



LOOP:     DAD H

       RAL

       JNC AHEAD

       DAD D



AHEAD:  DCR C

       JNZ LOOP

       SHLD 2504

       HLT





LSB OF MULTIPLICAND - 84H, MSB OF MULTIPLICAND - 00H ,MULTIPLIER - 56H





ANSWER

AT ADDRESS 2504 - 58H, LSBs OF PRODUCT

AT ADDRESS 2505 - 2CH, MSB sOF PRODUCT





Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming: 8 BIT DIVISION

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming








      LHLD 2501

      LDA 2503

      MOV B,A

      MVI C,08



LOOP:   DAD H

     MOV A,H

     SUB B

     JC AHEAD

     MOV H,A

     INR L



AHEAD: DCR C

      JNZ LOOP

      SHLD 2504

      HLT







INPUT:



LSB OF DIVIDEND - 9BH, MSB OF DIVIDEND - 48H , DIVISOR - 1AH







ANSWER

AT ADDRESS 2504 - F2H, QUOTIENT

AT ADDRESS 2505 - 07H, REMAINDER





Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming: 2's COMPLEMENT OF AN 8-BIT NUMBER

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming






The number to be complemented is stored in C050. Answer is stored in C051



  LDA C050

  CMA

  INR A

  STA C051

  HLT



EXAMPLE-> C050=96

Answer-> C051=6A





Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming: 2's COMPLEMENT OF A 16-BIT NUMBER

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming




The 16bit number is stored in C050,C051. The answer is stored in C052,C053



  LXI H,C050

  MVI B,00

  MOV A,M

  CMA

  ADI 01

  STA C052

  JNC GO

  INR B



GO:   INX H

  MOV A,M

  CMA

  STA C053

  HLT

EXAMPLE-> C050=8C,C051=5B

Answer-> C052=74,C053=A4





Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming: 1's COMPLEMENT OF AN 8-BIT NUMBER

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming




The number to be complemented is stored in C050. Answer is stored in C051



  LDA C050

  CMA

  STA C051

  HLT





EXAMPLE-> C050=96

Answer-> C051=69





Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming: 1's COMPLEMENT OF A 16-BIT NUMBER

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming




The 16bit number is stored in C050,C051

The answer is stored in C052,C053



  LXI H,C050

  MOV A,M

  CMA

  STA C052

  INX H

  MOV A,M

  CMA

  STA C053

  HLT

 EXAMPLE-> C050=85,C051=54

 Answer-> C052=7A,C053=AB



Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp

8085 Programming :

 Sumit Kar     November 21, 2014     8085, Assembly Programming     No comments   



8085 Programming



Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp
Older Posts Home

Pages

  • Home

Trending Now

  • Write a Program to Add two 3x3 Matrix using C
    #include<stdio.h> void main () { int a [ 3 ][ 3 ], b [ 3 ][ 3 ], s [ 3 ][ 3 ], i , j ; printf ( "Enter the values of ...
  • C program for Unit Conversion
    /* Convert Celsius to Fahrenheit */ #include<stdio.h> void main() {     float c,f;     printf("Enter the temperature in Celcius: ...
  • Addition of two numbers on Server sent from Client [TCP] using C
    /* tcpClient.c */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #inc...
  • Write a Program to Print the Truth Table of Basic Gates using C
  • Write a Program to Add two 5x5 Matrix using C
    #include<stdio.h> void main() {   int a[5][5],b[5][5],c[5][5];   int i,j;   for(i=0;i<5;i++)   {     printf("\nEnter elements ...
  • Using the concept of Inheritance write a C++ Program to calculate the area and perimeter of rectangle
    /* C++ Program to calculate the area and perimeter of rectangles using concept of inheritance. */ #include using namespace std; class Re...
  • Concatenation of two strings sent from Client on the Server - [ TCP ] using C
    /* tcpClient.c */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #inc...
  • 8085 Programming: Exchange the contents of memory locations
    Exchange the contents of memory locations 2000H and 4000H. Program 1: LDA 2000H : Get the contents of memory location 2000H into accumulator...
  • Calculate Depreciation using C
    #include<conio.h> #include<stdio.h> void main () { float sv , pv , dep ; int yos ; clrscr (); printf ( "Enter the pu...
  • 8085 Programming: 1's COMPLEMENT OF A 16-BIT NUMBER
    The 16bit number is stored in C050,C051 The answer is stored in C052,C053   LXI H,C050   MOV A,M   CMA   STA C052   INX H   MOV ...

Blog Archive

  • ▼  2020 (1)
    • ▼  May (1)
      • Automating your deployments using Ansible
  • ►  2015 (92)
    • ►  October (4)
    • ►  September (3)
    • ►  August (3)
    • ►  July (9)
    • ►  June (9)
    • ►  May (20)
    • ►  April (7)
    • ►  March (22)
    • ►  February (7)
    • ►  January (8)
  • ►  2014 (158)
    • ►  November (70)
    • ►  October (6)
    • ►  September (82)
Powered by Blogger.

Categories

C - Programming Java Programming Basic Technology 8085 Assembly Programming For Loop Numerical Methods WhatsApp Algorithm Shell Programming Programming Networking Windows Android C++ Programming CPP If Else Tricky Internet Microsoft Pattern Photography Socket Program News While Loop Array DBMS DS Macro Recursion User Defined Function Conditional Operator Data Structure Durga Puja Earthquake Google Mela Nokia SQL Share Yahoo Airtel Bio Command Prompt Confused Facebook Finance Firefox Ganges Graph HokKolorob Input Kolkata MCQ Math Matrix NetNeutrality Oracle Religion Search Sumit Kar Survey Switch Case Viral Virus Visual Studio do-while featured featured_slider

Popular Programs

  • Write a Program to Add two 3x3 Matrix using C
    #include<stdio.h> void main () { int a [ 3 ][ 3 ], b [ 3 ][ 3 ], s [ 3 ][ 3 ], i , j ; printf ( "Enter the values of ...
  • C program for Unit Conversion
    /* Convert Celsius to Fahrenheit */ #include<stdio.h> void main() {     float c,f;     printf("Enter the temperature in Celcius: ...
  • Addition of two numbers on Server sent from Client [TCP] using C
    /* tcpClient.c */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #inc...
  • Write a Program to Print the Truth Table of Basic Gates using C
  • Write a Program to Add two 5x5 Matrix using C
    #include<stdio.h> void main() {   int a[5][5],b[5][5],c[5][5];   int i,j;   for(i=0;i<5;i++)   {     printf("\nEnter elements ...
  • Using the concept of Inheritance write a C++ Program to calculate the area and perimeter of rectangle
    /* C++ Program to calculate the area and perimeter of rectangles using concept of inheritance. */ #include using namespace std; class Re...
  • Concatenation of two strings sent from Client on the Server - [ TCP ] using C
    /* tcpClient.c */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #inc...
  • 8085 Programming: Exchange the contents of memory locations
    Exchange the contents of memory locations 2000H and 4000H. Program 1: LDA 2000H : Get the contents of memory location 2000H into accumulator...
  • Calculate Depreciation using C
    #include<conio.h> #include<stdio.h> void main () { float sv , pv , dep ; int yos ; clrscr (); printf ( "Enter the pu...
  • 8085 Programming: 1's COMPLEMENT OF A 16-BIT NUMBER
    The 16bit number is stored in C050,C051 The answer is stored in C052,C053   LXI H,C050   MOV A,M   CMA   STA C052   INX H   MOV ...

Daily Hits

Copyright © Sumit Kar