1.寄存器保留CX
assume cs:code,ds:data
data segment
db 'ibm '
db 'dec '
db 'dos '
db 'vax '
data ends
code segment
start:
mov ax,data
mov ds,ax
mov bx,0
mov cx,4
s:mov dx,cx
mov si,0
mov cx,3
s0:mov al,[bx+si]
and al,11011111b
mov [bx+si],al
inc si
loop s0
mov cx,dx
add bx,16
loop s
mov ax,4c00h
int 21h
code ends
end start
2.内存空间保存CX
assume cs:code,ds:data
data segment
db 'ibm '
db 'dec '
db 'dos '
db 'vax '
data ends
code segment
start:
mov ax,data
mov ds,ax
mov bx,0
mov cx,4
s:mov [40h],cx
mov si,0
mov cx,3
s0:mov al,[bx+si]
and al,11011111b
mov [bx+si],al
inc si
loop s0
mov cx,[40h]
add bx,16
loop s
mov ax,4c00h
int 21h
code ends
end start
3.栈空间保存CX
assume cs:code,ds:data,ss:stack
data segment
db 'ibm '
db 'dec '
db 'dos '
db 'vax '
data ends
stack segment
dw 0
stack ends
code segment
start:
mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
mov bx,0
mov cx,4
s:push cx
mov si,0
mov cx,3
s0:mov al,[bx+si]
and al,11011111b
mov [bx+si],al
inc si
loop s0
pop cx
add bx,16
loop s
mov ax,4c00h
int 21h
code ends
end start
标签:8086,汇编语言,data,二重,db,mov,si,cx,bx
From: https://www.cnblogs.com/Mask2024/p/17993609