四、实验结论
1.
源程序:
assume cs:code, ds:data
data segment
db 12
db 0,0
data ends
code segment
start:
mov ax,data
mov ds,ax
mov ah,0
mov al,ds:[0]
mov bl,10
div bl
mov ds:[1],al
mov ds:[2],ah
mov ah,2
mov dl,[1]
add dl,30h
int 21h
mov ah,2
mov dl,[2]
add dl,30h
int 21h
mov ax,4c00h
int 21h
code ends
end start
运行结果:
2.
源程序:
assume cs:code, ds:data
data segment
db 12,35,96,55,67
data ends
code segment
start:
mov ax,data
mov ds,ax
mov cx,5
mov bp,0
s:mov ah,0
mov al,ds:[bp]
mov bl,10
div bl
mov dx,ax
mov ah,2
add dl,30h
int 21h
mov dl,dh
add dl,30h
int 21h
mov dl,20h
int 21h
inc bp
loop s
mov ax,4c00h
int 21h
code ends
end start
运行结果:
3.
源代码:
assume ds:data, cs:code
data segment
db 'welcome to masm!'
db 2H,24H,71H
data ends
code segment
start: mov ax,data
mov ds,ax
mov ax,0b800H
mov es,ax
mov cx,16
mov bp,0
mov bx,720H
s0:mov al,ds:[bp]
mov ah,2h
mov es:[bx],ax
inc bp
add bx,2h
loop s0
mov cx,16
mov bp,0
mov bx,7c0H
s1:mov al,ds:[bp]
mov ah,24h
mov es:[bx],ax
inc bp
add bx,2
loop s1
mov cx,16
mov bp,0
mov bx,860H
s2:mov al,ds:[bp]
mov ah,71h
mov es:[bx],ax
inc bp
add bx,2h
loop s2
mov ax,4c00h
int 21h
code ends
end start
运行结果:
自己写的代码还是稍显臃肿。在第二题中就发现寄存器有些捉襟见肘,虽然把商和余数都临时存放到DX里看起来还蛮巧妙,但本质上其实就是将未被使用的DH当作临时的存储空间,给人一种不够美妙不够自然的感觉。
……
以及,一、二、三、四、五……怎么就到九了?“根据材料编程”……这也太信达雅了吧!所以说即使实验本身魔改到这种程度标题还是要按照课本上来的吗?2233333