- 现有一组字符串为data,name,time,file,code,path,user,exit,quit,text,请编写程序从键盘输入4个字符的字符串,若存在将其删除, 并在显示器上显示。
DATAS SEGMENT
data db 'data,name,time,file,code,path,user,exit,quit,text,$';此处输入数据段代码
string1 db 'please input the word to be deleted:$'
buf db 10,?,10 dup (?)
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
;此处输入代码段代码
lea dx,data
mov ah,09h
int 21h
mov dl,10
mov ah,02h
int 21h
lea dx,string1
mov ah,09h
int 21h
lea dx,buf
mov ah,0ah
int 21h
mov si,0
mov cx,10
edg:
push cx
mov di,2
mov cx,4
rng:
mov al,buf[di]
mov ah,data[si]
cmp al,ah
jnz fpx
inc di
inc si
loop rng
pop cx
mov ax,0AH
sub ax,cx
mov bl,5
mul bl
mov si,ax
add ax,5
mov di,ax
mov ax,cx
dec ax
mul bl
inc ax
push cx
mov cx,ax
lng:
mov al,data[di]
mov data[si],al
inc di
inc si
loop lng
fpx: ;不等比较下一个
pop cx
mov ax,0BH
sub ax,cx
mov bl,5
mul bl
mov si,ax
loop edg
mov dl,10
mov ah,02h
int 21h
lea dx,data
mov ah,09h
int 21h
MOV AH,4CH
INT 21H
CODES ENDS
END START