汇编语言(王爽)实验
实验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 相关推荐
风月无古今 2020-06-06
风月无古今 2020-02-03
Emiter0 2020-01-30
风月无古今 2020-06-28
Emiter0 2020-06-28
andyljn 2020-06-13
李辉 2020-06-08
duling 2020-06-03
PLA 2020-05-25
风月无古今 2020-05-15
duling 2020-05-15
Emiter0 2020-05-10
Emiter0 2020-05-09
andyljn 2020-05-06
shunelly 2020-05-05
Emiter0 2020-04-30
李辉 2020-04-30
李辉 2020-04-25