X-man

导航

汇编实习一()

     在代码中,将起始地址为0:240,长度为16个字节的内存区域初始化为

0011h,0122h,0233h,0344h,0455h,0566h,0677h,0788h 要求:

    (1)把前面指定的数据,复制到起始地址为0:200的内存中去

    (2)用栈的机制实现将0:200 – 215中的数据顺序逆转

    (3)将0:200 – 215中的数据加和,传送到DX中 将代码完成,并编译、连接,生成exe文件,在Debug中调试

assume cs:b,ds:a,ss:c 
a segment     
      dw 0011h,0122h,0233h,0344h,0455h,0566h,0677h,0788h
a ends
c segment 
      dw 0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0
c ends
b segment
d:     mov ax,a
        mov ds,ax    ;ds指向a段
        mov bx,0
    
    mov ax,0024h
    mov es,ax
    mov cx,16
  s:   mov dl,[bx]
        mov  es:[bx],dl
    inc bx
    loop s

        mov ax,0020h
    mov ds,ax
    mov bx,0

    mov cx,16
  s0: mov dl,es:[bx]
        mov [bx],dl
    inc bx
        ;inc bx
    loop s0

    mov ax,c
    mov ss,ax ;指向ss段

    mov bx,0
        mov cx,8
  s1: push [bx] ;栈操作为两个字节
        add bx,2
    loop s1

       mov bx,0
       mov cx,8
  s2:pop[bx]
       add bx,2
       loop s2

       mov bx,0   ;1403:001A
       mov dx,0
       mov cx,8
  s3:add dx,[bx] 
       add bx,2
       loop s3
    mov ax,4c00h
    int 21h
b ends
end d

 

posted on 2013-04-12 20:40  雨钝风轻  阅读(296)  评论(0编辑  收藏  举报