?? 刪除文件中的半個漢字作業.txt
字號:
; 刪掉文件中的半個漢字---30060505錢學海
stack segment para stack
dw 100h dup(?)
stack ends
data segment para
filename1 db 'test.dat',0
handle1 dw ?
filename2 db 'test1.dat',0
handle2 dw ?
buff db 1024*10 dup(?)
len dw ?
data ends
code segment
assume cs:code,ds:data,ss:stack
start: mov ax,data
mov ds,ax
lea dx,filename1
mov cx,0
mov ah,3dh
mov al,0
int 21h
jnc l1
jmp return
l1: mov handle1,ax ;打開第一個文件
mov bx,ax
mov ah,3fh
mov cx,1025*10
lea dx,buff
int 21h
mov len,ax ;讀取數據至緩沖區
lea si,buff ;查到半個漢字后,刪除,并前移
mov di,si
push ds
pop es
cld
mov cx,len
lp1: test byte ptr[si],80h
jz con2
test byte ptr[si+1],80h
jnz con1
push si
push di
push cx
dec cx
inc si
cld
rep movsb
dec len
pop cx
dec cx
pop si
pop di
jmp lp1
con1: movsb
dec cx
con2: movsb
loop lp1
lea dx,filename2 ;創建第2個文件
mov cx,0
mov ah,3ch
int 21h
jc return
mov handle2,ax
mov bx,ax
mov ah,40h
mov cx,len
lea dx,buff
int 21h ;寫入
mov bx,handle1
mov ah,3eh
int 21h
mov bx,handle2
mov ah,3eh
int 21h
return: mov ah,4ch
int 21h
code ends
end start
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -