作者在 2016-06-21 12:07:11 发布以下内容
code segment
assume cs:code,ds:code,es:code,ss:code
org 100h
start:
jmp begin
buf db 80 dup(0)
rmov: ;本函数用于右移存储器内容4个字节,需挤进去的内容为bx,dx,在内存中顺序为bl bh dl dh,si为内存起始地址,结束符为$
push ax
push si
mov di,si
mlp1:
mov al,[si]
cmp al,'$'
jz mlp3
cmp dl,[si+2]
jb mlp2
mov di,si
mlp2:
add si,4
jmp mlp1
mlp3:
mov cx,si
sub cx,di
mov di,si
add di,4
std
mlp4:
lodsb
stosb
loop mlp4
mov [si],bx
mov [si+2],dx
pop si
pop ax
ret
begin:
mov bx,2020h
mov dx,bx
mov si,offset buf
code ends
end start
assume cs:code,ds:code,es:code,ss:code
org 100h
start:
jmp begin
buf db 80 dup(0)
rmov: ;本函数用于右移存储器内容4个字节,需挤进去的内容为bx,dx,在内存中顺序为bl bh dl dh,si为内存起始地址,结束符为$
push ax
push si
mov di,si
mlp1:
mov al,[si]
cmp al,'$'
jz mlp3
cmp dl,[si+2]
jb mlp2
mov di,si
mlp2:
add si,4
jmp mlp1
mlp3:
mov cx,si
sub cx,di
mov di,si
add di,4
std
mlp4:
lodsb
stosb
loop mlp4
mov [si],bx
mov [si+2],dx
pop si
pop ax
ret
begin:
mov bx,2020h
mov dx,bx
mov si,offset buf
code ends
end start