Data transfer program between data blocks

Source: Internet
Author: User

Data Block movement. Move the data of one contiguous storage unit to another contiguous storage unit and find out the number of 0 and display it. (Be aware of the uncertainties in the location of the data blocks when making the process)

1 DATA SEGMENT2ORG $+20H3VA DB'2014001002003004'; Data Block4LEN EQU $-VA; Data block length5 V1 DW VA; source Block first address6V2 DW va+1; destination Block first address7 DATA ENDS8 STACK1 SEGMENT STACK9DW 20H DUP (0)Ten STACK1 ENDS One CODE SEGMENT A assume Cs:code,ds:data,ss:stack1 - Start:mov Ax,data - MOV Ds,ax the MOV bl,30h; set counter (count 0) - MOV Cx,len; set counter (transfer condition) - MOV Si,v1; Si point to source block first address - MOV di,v2;D I point to destination block first address + CMP Si,di; compare two first addresses and choose different modes of delivery - JA J2 +ADD si,len-1 AADD di,len-1 at J1:mov Al,[si] - MOV [Di],al - CMP al,30h - JNE J01 - INC BL - J01:dec SI in DEC DI - DEC CX to JNE J1 + JMP Done - J2:mov Al,[si] the MOV [Di],al * CMP al,30h $ JNE J02Panax Notoginseng INC BL - j02:inc SI the INC DI + DEC CX A JNE J2 theDone:mov AH,2; showing 0 numbers + MOV DL,BL - INT 21H $MOV ah,4ch;returnDOS $ INT 21H - CODE ENDS -END START
View Code

Two modes of transmission correspond to two cases respectively.

Data transfer programs between data blocks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.