|
发表于 2012-8-30 21:18:21
|
显示全部楼层
assume cs:codesg,ds:datasg,ss:stack
datasg segment
db 'welcome to masm!'
db 02h,24h,71h
datasg ends
stack segment
dw 8 dup(0)
stack ends
codesg segment
start:
mov ax,datasg
mov ds,ax ;设置段地址
mov ax,stack
mov ss,ax
mov sp,10h ;栈
mov ax,0b872h ;显示的段地址
sub di,di
sub si,si
mov es,ax
mov cx,3 ;3行,循环3次
s1:
push cx ;将cx的值推进栈中
mov ah,ds:[di+10h] ;将颜色属性放入ah中
sub bx,bx
mov cx,16 ;行循环16次
s:
mov al,ds:[bx]
mov es:[si],al ;将字符复制到显示的行中
mov es:[si+1],ah ;将颜色属性放入字符的后一个字节中
inc bx ;改变字符
add si,2
loop s
add di,1 ;改变颜色属性
add si,0a0h
pop cx
loop s1
mov ax,4c00h
int 21h
codesg ends
end start |
|