11

(1) 下面的程序实现依次用内存0:0~0:15单元中的内容改写程序中的数据,完成程序:

assume cs:codesg

codesg segment

dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h

start: mov ax,0
mov ds,ax
mov bx,0

mov cx,8
s: mov ax,[bx]
mov cs:[bx],ax
add bx,2
loop s

mov ax,4c00h
int 21h
codesg ends

end start

(2) 下面的程序实现依次用内存0:0~0:15单元中的内容改写程序中的数据,数据的传送用栈来进行,栈空间设置在程序内。完成程序:


assume cs:codesg

codesg segment

dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h
dw 0,0,0,0,0,0,0,0,0,0

start: mov ax,cs
mov ss,ax
mov sp,24h

mov ax,0
mov ds,ax
mov bx,0
mov cx,8
s: push [bx]
pop cs:[bx]
add bx,2
loop s

mov ax,4c00h
int 21h
codesg ends

end start

<!-- JiaThis Button BEGIN --> <style type="text/css"> #ckepop a:hover { color:red; background-color:#0063DC; } </style> <div id="ckepop"> <a href="http://www.jiathis.com/share/" class="jiathis_txt" target="_blank">分享到:</a> <a class="jiathis_button_tqq">腾讯微博</a> <a class="jiathis_button_tsina">新浪微博</a> <a class="jiathis_button_qzone">QQ空间</a> <a class="jiathis_button_hi">百度空间</a> <a class="jiathis_button_kaixin001">开心网</a> <a class="jiathis_button_renren">人人网</a> <a class="jiathis_button_xiaoyou">QQ校友</a> <a href="http://www.jiathis.com/share/?uid=89488" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank">更多...</a> </div> <script type="text/javascript" src="http://v2.jiathis.com/code/jia.js?uid=89488" charset="utf-8"></script> <!-- JiaThis Button END -->

5 Responses to “王爽汇编语言(第2版)检测点6.1”

  1. 匿名 Says:

    第二个程序第 10行 应该是mov sp 26

  2. 匿名 Says:

    10个字的栈空间,相当于20个字节。即从10H–23H,当栈空间内容为空时,栈顶SP应该指向24H

  3. BLDT Says:

    0:0~15 共计16个内存单元空间,而栈用字的格式来填充,故第10行为:MOV SP,24H

  4. 匿名 Says:

    书中 程序 6.3

    mov sp,30h,为什么不是 mov sp,20h,前面的DW只占了32个Byte即20H

    是不是印错了?

  5. 匿名 Says:

    娘的 就是错了。。害我 调了半天。。。

Leave a Reply