马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 风不会停息 于 2018-5-28 17:04 编辑
实验10.1
以下两种代码在对行和列的处理上哪里不同了?
assume cs:code, ds:data
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 cx
mov di, 0
mov bx, 0B800H
mov al, 16
mov ah, 0
mul dh
add bx, ax
mov es, bx ;设定行
mov ax, 0
mov al, 2
mul dl
mov di, ax ;设定列
show: mov ch, 0
mov cl, [si]
jcxz ok
mov al, [si]
mov es:[di - 2], al
pop cx
mov es:[di - 1], cl
push cx
inc si
add di, 2
jmp short show
ok: pop cx
ret
code ends
end start
assume cs:code, ds:data
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 cx
mov di, 0
mov ax, 0B800H
mov es, ax
mov al, 160
mov ah, 0
mul dh
mov di, ax ;设定行
mov ax, 0
mov al, 2
mul dl
add di, ax ;设定列
show: mov ch, 0
mov cl, [si]
jcxz ok
mov al, [si]
mov es:[di - 2], al
pop cx
mov es:[di - 1], cl
push cx
inc si
add di, 2
jmp short show
ok: pop cx
ret
code ends
end start
|