www.rtmj.net > 用汇编语言编程序,完成将内存D002开始的10个单元...

用汇编语言编程序,完成将内存D002开始的10个单元...

mov cx,10mov ax,0mov ds,axmov ax,0mov es,axmov si,3500hmov di,3600hrep movsb

MOV AX, 1000HMOV DS, AXMOV AX, 2000HMOV ES, AXMOV BX, 0000HMOV CX, 16MOV AH, 0LP: MOV AL, DS:[BX] MOV DS:[BX], AH MOV ES:[BX], AL INC BX LOOP LPHLT

8086汇编程序如下:MOV AX, 0A500H MOV DS, AX MOV BX, 0000H;DS:BX组成物理地址A5000H MOV CX, 100;一共6个单元清0 AGAIN: MOV [BX], 00H INC BX LOOP AGAIN

mov al, 7fh mov ax, xxxx ; 数据段地址 mov es, ax mov di, 6000H; mov cx, 10 repnz stosb

data segment org 1000h buff db 100(0) data ends code segment assume cs:code,ds:data start:mov ax,data mov ds,ax lea bx,buff mov cx,100 next:mov byte ptr [bx],0 inc bx loop next mov ah,1 int 21h mov ax,4c00h int 21h code ends end start

movl $0x41000, %esi movl $0x41100, %edi movl $10, %ecx rep movsb 上面的这段是用at&t语法写的,将41000处开始的10字节内容复制到41100处.movsb功能是将esi指定的内存区域复制1字节到edi指定的内存区域,rep指令重复执行它后面的指令,重复次数由ecx指定.

看看下列程序:ASSUME CS:SEG2, DS: SEG1SEG1 SEGMENT DB 12H, 34H, 56H, 78H, 90H DB 2AH, 3BH, 4CH, 5DH, 6EH ORG 0010H DB 10 DUP(0)SEG1 ENDSSEG2 SEGMENTSTART: MOV BX, SEG1 MOV DS, BX;--------------------

#include"stdio.h"void fun(int a[])int i,j,t;for(i=0;i<9;i++)for(j=i+1;j<10;j++)if(a[i]>a[j]){t=a[i];a[i]=a[j];a[j]=t;}void main()FILE *wf;int a[10];int b[10]={9,10,11,12,1,2,3,4,0,1};int c[10]={1,2,3,4,13,14,15,16,2,3};int i;printf("请输入待排序的10个数:");for(i=0;i<10;i++)scanf("%d",&a[i]);fun(a);

mov di, 30hmov al, 0mov cx, 10@1:stosbloop @1

mov si,20hmov di,30hmov cx,10cldrep movsb

网站地图

All rights reserved Powered by www.rtmj.net

copyright ©right 2010-2021。
www.rtmj.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com