assume cs:code
data segment
db 'Welcome to masm!hhhhhhhhhhh',0
data ends
stack segment
dw 0,0,0,0,0,0,0,0
stack ends
code segment
start:
mov dh,10
mov dl,10
mov cl,1
mov ax,data
mov ds,ax
mov si,0
mov ax,stack
mov ss,ax
mov sp,16
call show_str
mov ax,4c00h
int 21h
show_str:
push si
push cx
push es
;转换行标列标为显存地址
;行标的偏移地址bx
dec dh
mov al,160
mul dh
mov bx,ax
;列标的偏移地址di
dec dl
mov al,2
mul dl
mov di,ax
;偏移地址di
add di,bx
;显存段地址bx
mov ax,0b800h
mov es,ax
;颜色bl
mov bl,cl
change:
mov cl,[si]
mov ch,0
jcxz ok
mov ch,bl
mov es:[di],cx
add di,2
inc si
jmp short change
ok: pop es
pop cx
pop si
ret
code ends
end start
;为什么在第7行显示:被推上去一行,先空格行,在显示,在多加一行
;参数dh,dl,cl
王爽汇编实验lab10-1
于 2022-03-16 08:46:34 首次发布