• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
projectsgeek

ProjectsGeek

Download Mini projects with Source Code, Java projects with Source Codes

  • Home
  • Java Projects
  • C++ Projects
  • VB Projects
  • PHP projects
  • .Net Projects
  • NodeJs Projects
  • Android Projects
    • Project Ideas
      • Final Year Project Ideas
      • JSP Projects
  • Assignment Codes
    • Fundamentals of Programming Language
    • Software Design Laboratory
    • Data Structure and Files Lab
    • Computer Graphics Lab
    • Object Oriented Programming Lab
    • Assembly Codes
  • School Projects
  • Forum

Transfer Block of N Bytes from Source to Destination

May 4, 2011 by ProjectsGeek 1 Comment

Transfer block of N bytes from source to destination 

Algorithm for Transfer block of N bytes
Step I          :   Initialize the data in the source memory and destination memory.
Step II         :   Initialize SI and DI with source and destination address.
Step III       :   Initialize CX register with the count.
Step IV       :   Initialize the direction flag to zero.
Step V         :   Transfer the data block byte by byte to destination.
Step VI       :   Decrement CX.
Step VII      :   Check for count in CX, if not zero goto step V else goto step VIII.
Step VIII    :   Display the bytes in destination location.
Step IX       :   Stop.
 

Transfer Block of N Bytes Code   

 

.model small  
 .data  
        src_blk db 01, 02, 03, 04, 05, 06, 07, 08, 09, 0AH  
        dest_blk db 10 dup(?)  
        count dw 0AH  
 .code   
        mov  ax, @data          ; initialize data  
        mov  ds, ax  
        mov  es, ax  
        mov  si, offset src_blk     ; si to point to source block  
        mov  di, offset dest_blk    ; di to point to destination block  
        mov  cx, count           ; initialize counter  
        cld                    ; df=0  
 again :  rep   movsb                   ; transfer contents  
        mov  di, offset dest_blk    ; di to point to  
                               ; destination block  
        mov  bh, 0Ah            ; initialize counter  
 up:     mov  bl, [di]             ; store result in bl  
        mov  cx, 0204h    ; Count of digits to be  
                         displayed in    
                         ; ch and digits to be  
                         mrolled in cl   
 l1:     rol   bl, cl        ; roll bl so that msb comes  
                         to lsb  
        mov  dl, bl        ; load dl with data to be  
                         displayed  
        and  dl, 0fh       ; get only lsb  
        cmp  dl, 09h      ; check if digit is 0-9    
                         ; or letter A-F  
        jbe   l12  
        add  dl, 07h            ; if letter add 37H      
                         ; else only add 30H  
 l12:    add  dl, 30h  
        mov  ah, 02       ; Function 02 under  
                         ; INT 21H                        
        int   21h  
        dec  ch          ; Decrement Count  
        jnz   l1  
        dec  bh          ; decrement counter  
        inc   di  
        mov  ah, 02h            ; display space        
                         ; between bytes  
        mov  dl, ' '  
        int   21h  
        cmp  bh, 00h            ; repeat till all bytes  
                         ; are displayed  
        jne   up  
        mov  ah, 4ch      ; normal termination  
                         ; to dos  
        int   21h  
 end

 

 

Other Projects to Try:

  1. Add 8 Bit BCD Numbers
  2. BCD to 7 Segment Code Conversion
  3. 2s Complement of a Numbers Assembly Code
  4. How to find 1’s complement of a number
  5. Multiply Two 8 Bit Numbers using Add and Shift Method

Filed Under: Assembly Codes Tagged With: Assembly Codes

Reader Interactions

Comments

  1. embroidery services says

    August 8, 2013 at 10:45 pm

    Very nice blog post. I definitely appreciate this website.
    Keep writing!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Tags

.Net Projects Download Android Project Ideas Android Projects Angular 2 Assembly Codes C # Projects C & C++ Projects C++ Projects Class Diagrams Computer Graphics Database Project Data Mining Projects DataScience Projects Datastructure Assignments Download Visual Basic Projects Electronics project Hadoop Projects Installation Guides Internet of Things Project IOS Projects Java Java Interview Questions Java Projects JavaScript JavaScript Projects java tutorial JSON JSP Projects Mechanical Projects Mongodb Networking Projects Node JS Projects OS Problems php Projects Placement Papers Project Ideas Python Projects seminar and presentation Struts

Search this Website


Footer

Download Java Project
Download Visual Basic Projects
Download .Net Projects
Download VB Projects
Download C++ Projects
Download NodeJs Projects
Download School Projects
Download School Projects
Ask Questions - Forum
Latest Projects Ideas
Assembly Codes
Datastructure Assignments
Computer Graphics Lab
Operating system Lab
australia-and-India-flag
  • Home
  • About me
  • Contact Form
  • Submit Your Work
  • Site Map
  • Privacy Policy