1. 程式人生 > >匯編 實驗四

匯編 實驗四

什麽是 erl col ont 推出 assume bsp png back

實驗內容 一:

技術分享圖片

技術分享圖片

運行截圖:

技術分享圖片

調試截圖

技術分享圖片

實驗內容 二 :

技術分享圖片

1)

技術分享圖片

調試截圖:

技術分享圖片

技術分享圖片

2)

參考代碼:  (來源於網絡)

assume cs:code
code segment
mov ax,20h
mov ss,ax
mov sp,40h
mov bx,3f3eh
mov cx,32
s: push bx
sub bx,0202h
loop s
mov ax,4c00h
int 21h

code ends
end

技術分享圖片

調試截圖

技術分享圖片

未解: sp的定義為什麽是40h?

實驗內容 三 :

(3)下面的程序功能是將“mov ax,4c00h"之前的指令復制到內存0:200處,補全程序。上機調試,跟蹤運行結果。

assume cs:code

code segment

mov ax,cs

mov ds,ax

mov ax,0020h

mov es,ax

mov bx,0

mov cx,17h

s: mov al,[bx]

mov es:[bx],al

inc bx

loop s

mov ax,4c00h

int 21h

code ends

end

解答:

第一空 : 將段代碼CS:存放當前正在運行的程序代碼所在段的段基值賦值給 ds

第二空 : 推出來的

先隨便令 cx=20

技術分享圖片

通過反匯編

技術分享圖片

“mov ax,4c00h"之前 是至 0017

所以如果將“mov ax,4c00h"之前的指令復制到內存0:200處 需復制17個字節

需循環17次

cx =17h

匯編 實驗四