臭臭的 发表于 2012-3-9 22:56:45

实验九,能正确显示,就是系统会弹出一个错误窗口

;显屏幕中间分别显示绿色、绿底红字、白底蓝字的字符串'welcome to masm'
assume cs:codesg,ds:datasg,ss:stacksg
datasg segment
db 'welcome to masm!'
db 02h,24h,71h
datasg ends
stacksg segment
dw 8 dup(0)
stacksg ends
codesg segment
start:mov ax,datasg
       mov ds,ax   
    mov ax,stacksg
    mov ss,ax
    mov sp,10h
    mov bx,0          ;颜色偏移地址
   
    mov ax,0b872h   ;第一行字符串起始段地址
    mov cx,3          ;3行循环3次
s0:push cx
    push ax
    mov si,0         ;源偏移地址
    mov di,0         ;目标偏移地址
   
    mov es,ax
    mov cx,16         ;16个字符
s: mov al,ds:
    mov es:,al      ;字符写到目标
    mov al,ds:10h
    mov es:,al    ;这里我直接把颜色跟在字符后面了,所以直接di+1
    inc si
    add di,2
    loop s
   
    inc bx
    pop ax
    add ax,0ah
    pop cx
    loop s0
   
   
codesg ends
end start

臭臭的 发表于 2012-3-9 23:08:22

自己debug 发现了,
漏了结束的那句话
mov ax,4c00h
int 21h
页: [1]
查看完整版本: 实验九,能正确显示,就是系统会弹出一个错误窗口