n2zee 发表于 2012-3-3 10:04:09

自己写的实验10.1

assume cs:code
data segment
db 'welcome to masm!',0
data ends

code segment
start:
mov dh,8
mov dl,3
mov cl,33
mov ax,data
mov ds,ax
mov si,0
call show_str

mov ax,4c00h
int 21h

show_str:
mov ax,0b800h
mov es,ax
mov bx,0
mov di,0
mov si,0
mov ax,160
mul dh;求行首字母数量 (m-1)160
add dl,dl;求列首字母数量 (n-1)2
mov dh,0
mov di,dx
add di,ax
sub di,162;求总数量
mov bl,cl
s:
mov al,byte ptr ds:
mov cl,al
mov ch,0
jcxz ok
mov byte ptr es:,al
mov byte ptr es:,bl
inc si
add di,2
jmp short s

ok:
ret

code ends
end start

n2zee 发表于 2012-3-3 10:10:24

assume cs:code
data segment
db 'welcome to masm!',0
data ends

code segment
start:
mov dh,8
mov dl,3
mov cl,33
mov ax,data
mov ds,ax
mov si,0
call show_str

mov ax,4c00h
int 21h

show_str:
mov ax,0b800h
mov es,ax
mov bx,0
mov di,0
mov si,0
mov ax,160
mul dh;求行首字母数量 (m-1)160
add dl,dl;求列首字母数量 (n-1)2
mov dh,0
mov di,dx
add di,ax
sub di,162;求总数量
mov ah,cl;颜色参数赋值给ah
s:
mov al,byte ptr ds:
mov cl,al
mov ch,0
jcxz ok
mov word ptr es:,ax
inc si
add di,2
jmp short s

ok:
ret

code ends
end start

1023545590 发表于 2012-3-3 10:31:01

嗯嗯!!!都比我厉害
页: [1]
查看完整版本: 自己写的实验10.1