assume cs:codesg,ds:datasg,ss:stacksg
datasg segment
db 'Welcome to MASM!'
db 00000010B,00100100B,01110001B
datasg ends
stacksg segment
dw 0,0,0,0,0,0,0,0
stacksg ends
codesg segment
start:mov ax,datasg
mov ds,ax
mov ax,0B85AH
mov es,ax
mov di,10H ;ds:[di] -> 字体属性
mov cx,3
s0:push cx
mov bx,0 ;ds:[bx] -> 待显示的字符
mov si,40H ;es:[si] -> 显示缓冲区
mov cx,16
s:mov al,[bx]
mov es:[si],al
mov al,[di]
mov es:[si+1],al
inc bx
add si,2
loop s
inc di
add si,0A0H
pop cx
loop s0
mov ax,4C00H
int 21H
codesg ends
end start
为什么只有第三行(白底蓝字)的显示出来了…第一行和第二行都没有显示出来…
3 个解决方案
#2
根据楼主的改了下
assume cs:codesg,ds:datasg,ss:stacksg
datasg segment
db 'Welcome to MASM!'
db 00000010B,00100100B,01110001B
datasg ends
stacksg segment
dw 0,0,0,0,0,0,0,0
stacksg ends
codesg segment
start:mov ax,datasg
mov ds,ax
mov ax,0B85AH
mov es,ax
mov di,10H ;ds:[di] -> 字体属性
mov cx,3
mov si,40H ;es:[si] -> 显示缓冲区
s0:
push cx
push si
mov bx,0 ;ds:[bx] -> 待显示的字符
mov cx,16
s:
mov al,[bx]
mov es:[si],al
mov al,[di]
mov es:[si+1],al
inc bx
add si,2
loop s
inc di
pop si
add si,0A0H
pop cx
loop s0
mov ax,4C00H
int 21H
codesg ends
end start
#3
昨天发现错误了…循环没设置合适…导致后面一行覆盖了前面一行…所以只显示了最后一行…
#1
#2
根据楼主的改了下
assume cs:codesg,ds:datasg,ss:stacksg
datasg segment
db 'Welcome to MASM!'
db 00000010B,00100100B,01110001B
datasg ends
stacksg segment
dw 0,0,0,0,0,0,0,0
stacksg ends
codesg segment
start:mov ax,datasg
mov ds,ax
mov ax,0B85AH
mov es,ax
mov di,10H ;ds:[di] -> 字体属性
mov cx,3
mov si,40H ;es:[si] -> 显示缓冲区
s0:
push cx
push si
mov bx,0 ;ds:[bx] -> 待显示的字符
mov cx,16
s:
mov al,[bx]
mov es:[si],al
mov al,[di]
mov es:[si+1],al
inc bx
add si,2
loop s
inc di
pop si
add si,0A0H
pop cx
loop s0
mov ax,4C00H
int 21H
codesg ends
end start
#3
昨天发现错误了…循环没设置合适…导致后面一行覆盖了前面一行…所以只显示了最后一行…