汇编语言上机考试三星题2

简单的bug找了一下午

现有一组字符串为data,name,time,file,code,path,user,exit,quit,text,请编写程序从键盘输入4个字符的字符串,若存在将其删除, 并在显示器上显示。

有空再加注释吧。

DATAS SEGMENT

    BUF1 DB 'data,name,time,file,code,path,user,exit,quit,text','$'

    BUF2 DB 5

    DB ?

    DB 5 DUP(?)

    ;此处输入数据段代码 

DATAS ENDS

STACKS SEGMENT

    ;此处输入堆栈段代码

STACKS ENDS

CODES SEGMENT

    ASSUME CS:CODES,DS:DATAS,SS:STACKS

START:

    MOV AX,DATAS

    MOV DS,AX

    MOV ES,AX

    LEA DX,BUF2

    MOV AH,0AH

    INT 21H

    MOV DL,0AH

    MOV AH,02H

    INT 21H

    MOV CH,10

    MOV CL,04H

    LEA SI,BUF1

    LEA DI,BUF2[2]

L:

CMP CH,0

JZ END0

NEXT:

CMPSB

JNZ TIAOZHUAN

DEC CL

CMP CL,0

JZ CHANGE

JMP NEXT

TIAOZHUAN:

CMP CL,0

JZ DAYIN

DEC CL

INC SI

JMP TIAOZHUAN

DAYIN:

MOV DL,BUF1[SI-5]

MOV AH,02H

INT 21H

MOV DL,BUF1[SI-4]

MOV AH,02H

INT 21H

MOV DL,BUF1[SI-3]

MOV AH,02H

INT 21H

MOV DL,BUF1[SI-2]

MOV AH,02H

INT 21H

CMP BUF1[SI-1],'$'

JZ END0

MOV DL,BUF1[SI-1]

LEA DI,BUF2[2]

MOV AH,02H

INT 21H

MOV CL,4

DEC CH

JMP L

CHANGE:

INC SI

DEC CH

MOV CL,4

LEA DI,BUF2[2]

JMP L

END0:

    ;此处输入代码段代码

    MOV AH,4CH

    INT 21H

CODES ENDS

    END START

你可能感兴趣的:(汇编语言上机考试三星题2)