1.显示字符串
完整源码
assume cs:code
data segment
db 'welcome to masm!',0
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 es
push dx
push bx
push cx
push si
push di
mov ax,0b800h
mov es,ax
dec dh
mov al,160
mul dh
mov bx,ax
mov al,2
mul dl
add bx,ax
mov dl,cl
mov di,0
show: mov cl,[si]
mov ch,0
jcxz ok
mov es:[bx+di],cl
mov es:[bx+di+1],dl
inc si
add di,2
jmp short show
ok: pop di
pop si
pop cx
pop bx
pop dx
pop es
pop ax
ret ;子程序调用 返回
code ends
end start
代码说明
- 行号(取值范围 0~24),第8行是相对第0行起算的;
- 列好(取值范围 0~79),第3列是相对第0列起算的;