🍀王爽 《汇编语言》 实验4解答🍀
(1)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| assume cs:codesg
codesg segment
mov ax,0 mov ds,ax
mov al,0 mov bx,0200h mov cx,64 s: mov [bx],al inc bx inc al loop s mov ax,4c00h int 21h
codesg ends
end
|
(2)是(1)的改进
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| assume cs:codesg
codesg segment
mov ax,20H mov ds,ax mov bx,0 mov cx,64 s: mov ds:[bx],bx inc bx loop s mov ax,4c00H int 21H
codesg ends
End
|
实验结果:
(3)cx是程序的长度,我们可利用debug中的-u命令来直接读取所需程序段的长度。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| assume cs:code code segment
mov ax,code mov ds,ax mov ax,0020h mov es,ax mov bx,0 mov cx,18h s: mov al,ds:[bx] mov es:[bx],al inc bx loop s mov ax,4c00H int 21H code ends End
|
实验结果: