这个实验的内容不是太麻烦,双层的循环代码前几章有示例代码,
程序执行后,第一行的绿色字没有显示出来,这个我没有找到原因,剩下的两行显示的都是正确的(后来又加了一行红底绿字),下面是效果图
实验9内容如下:


我的代码如下:
assume cs:codesg,ds:datasg
datasg segment
dw 0 ; 保存外层的循环次数
db 2h ; 绿色字
db 24h ; 绿底红字
db 80h ; 白底蓝字
db 0C2h ;红底绿字
db 'welcome to masm!'; 要显示的内容
datasg ends
codesg segment
start: mov ax,datasg
mov ss,ax
mov ax,0B800h ;显存基地址
mov ds,ax
mov cx,4 ; 循环次数
mov bp,2 ; 颜色的基地址
mov dx,3872 ; 保存第一行字的起始位置,第12行33列
sout:mov ss:[0],cx
mov cx,16
mov bx,dx ; start position
mov si,6 ; start position of string
sin:mov al,ss:[si]
mov [bx],al
mov al,[bp]
mov [bx+1],al
add bx,2
inc si
loop sin
inc bp
add dx,160
mov cx,ss:[0]
loop sout
mov ax,4c00h
int 21h
codesg ends
end start
