王爽<汇编语言> 第九章 实验九
assume cs:codesg,ds:datasg,ss:stacksg
datasg segment
dw 0A0h ;width ;0h
dw 19h ;height ;2h
dw 0 ;beginPoint ;4h
db 'welcome to masm!' ;text ;6h
db 2h ;绿色 ;16h
db 24h ;绿底红色 ;17h
db 71h ;白底蓝色 ;18h
datasg ends
stacksg segment
db 16 dup (0)
stacksg ends
buffsg segment
db 32 dup(0)
buffsg ends
codesg segment
setStyle:push ax
push cx
push dx
mov al,ds:6h[si]
mov es:[di],al
inc si
inc di
pop dx;
mov es:[di],dl
inc di
pop cx
pop ax
loop setStyle
jmp ax
start:mov ax,datasg
mov ds,ax
mov ax,stacksg
mov ss,ax
mov sp,10h
mov ax,buffsg
mov es,ax
mov si,0
mov di,0
mov cx,8
mov dx,0
mov dl,ds:[16h]
mov ax,offset to
jmp setStyle
to:mov cx,3
mov dx,0
mov dl,ds:[17h]
mov ax,offset masm
jmp setStyle
masm:mov cx,5
mov dx,0
mov dl,ds:[18h]
mov ax,offset next
jmp setStyle
next:mov ax,ds:[2h]
mov dx,0
mov bx,2
div bx
mov cx,ax
mov ax,0
s:add ax,ds:[0h]
loop s
push ax
mov ax,ds:[0h]
sub ax,10h
mov dx,0
mov bx,2h
div bx
pop bx
add ax,bx
push ds
mov bx,0b800h
mov ds,bx
mov bx,ax
mov cx,32
mov si,0
s1:mov al,es:[si]
mov ds:[bx][si],al
inc si
loop s1
mov ax,4c00h
int 21h
codesg ends
end start