王爽 組合語言 第九章實驗9

2021-04-30 22:40:27 字數 610 閱讀 7094

用單迴圈實現的..

assume cs:codesg,ds:datasg

datasg segment

db 'welcome to masm!'

db 02h,02h,02h,02h,02h,02h,02h,02h,42h,42h,42h,71h,71h,71h,71h,71h

datasg ends

codesg segment

start:

mov ax,datasg

mov ds,ax

mov ax,0b800h

mov es,ax

mov di,64

mov si,0

mov bx,0820h

mov cx,16

s: mov   al,ds:[si]

mov es:[bx+di],al

inc di

mov al,ds:[si+16]

mov es:[bx+di],al

inc si

inc di

loop s

mov ax,4c00h

int 21h

codesg ends

end start    

王爽《組合語言》第九章實驗9

這個實驗的內容不是太麻煩,雙層的迴圈 前幾章有示例 實驗9內容如下 我的 如下 assume cs codesg,ds datasg datasg segment dw 0 儲存外層的迴圈次數 db 2h 綠色字 db 24h 綠底紅字 db 80h 白底藍字 db 0c2h 紅底綠字 db wel...

王爽 組合語言 第九章 實驗八

輸入程式 assume cs codesg codesg segment mov ax,4c00h int 21h start mov ax,0 s nop nopmov di,offset s mov si,offset s2 mov ax,cs si mov cs di ax s0 jmp sh...

組合語言 第九章 實驗

可以正常執行。分析,前面的程式都很簡單,沒啥問題,到了 mov ax,cs si mov cs di ax 這裡,由於s2處的jmp short s1指令jmp機器碼為eb,之後記錄的是跳轉的距離,這裡向上跳到s1處,所以jmp short s1只佔2個位元組,所以jmp short s1處的 就被...