汇编实验5

 

1. 将下面的程序编译、连接、加载、跟踪,然后回答问题。

assume cs:code,ds:data,ss:stack
data segment
    dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h
data ends

stack segment
    dw 0,0,0,0,0,0,0,0
stack ends
code segment
start:
    mov ax,stack
    mov ss,ax
    mov sp,16
    mov ax,data
    mov ds,ax
    push ds:[0]
    push ds:[2]
    pop ds:[2]
    pop ds:[0]

    mov ax,4c00h
    int 21h
code ends
end start

 

  

  

  

2.

  

assume cs:code,ds:data,ss:stack

data segment
    dw 0123h,0456h
data ends

stack segment
    dw 0,0
stack ends

code segment
start:
        mov ax,stack
        mov ss,ax
        mov sp,16

        mov ax,data
        mov ds,ax

        push ds:[0]
        push ds:[2]
        pop  ds:[2]
        pop  ds:[0]

        mov ax,4c00h
        int 21h
code ends
end start

 

  

  

3.

  

assume cs:code ,ds:data,ss:stack

code segment
start:
    mov ax,stack
    mov ss,ax
    mov sp,16
    mov ax,data
    mov ds,ax
    push ds:[0]
    push ds:[2]
    pop ds:[2]
    pop ds:[0]

    mov ax,4c00h
    int 21h
code ends
data segment
    dw 0123H,0456H
data ends

stack segment
    dw 0,0
stack ends
end start

 

  

  

  

5.

  

code segment
start:
    mov ax,a
    mov ds,ax
    mov bx,0
    mov cx,8
      s:mov al,ds:[bx]
    add al,ds:[bx+16]
    mov ds:[bx+32],al
    inc bx
    loop s

    mov ax,4c00h
    int 21h
code ends

6. 

  

code segment
start:
    mov ax,a
    mov ds,ax
    mov bx,0
    mov ax,b
    mov ss,ax
    mov sp,16
    mov cx,8
      s:push [bx]
    inc bx
    inc bx
    loop s
    mov ax,4c00h
    int 21h
code ends

 

posted @ 2017-06-01 11:20  cs的蜗牛  阅读(146)  评论(0编辑  收藏  举报