andyljn 2019-10-28
实验10
;name: show_str ;func: 在指定的位置,用指定的颜色,显示一个用‘0‘结束的字符串 ;argc: (dh)=行号(取值范围0~24), (dl)=列号(取值范围0~79) ; (cl)=颜色, ds:si指向字符串的首地址 ;return: None assume cs:code data segment db ‘Welcome to masm!‘, 0, ‘x‘ data ends code segment start: mov dh, 8 mov dl, 3 mov cl, 2 mov ax,data mov ds,ax mov si, 0 call show_str mov ax, 4c00h int 21h show_str: push ax push bx push es push cx push dx push si mov ax, 0b800h mov es, ax mov bx, 0 mov al, 160 mul dh add bx, ax mov al, 2 mul dl add bx, ax ;print start position print: mov cl, 0 ;judge end mov ch, ds:[si] jcxz return mov al, [si] ;character mov ah, 02h ;(color) BL RGB I RGB mov es:[bx], ax add bx, 2 inc si jmp short print return: pop si pop dx pop cx pop es pop bx pop ax ret code ends end start