注释待更新
根据学长代码改编,也不知道结果对不对
现有一控制程序共5个工序,要求输入0-4的序号,分别执行各工序的子程序,每个子程序的任务是显示其入口地址。调用后继续等待调用,按回车则结束程序的执行。
DATAS SEGMENT
BUF DW BUF1,BUF2,BUF3,BUF4,BUF5;此处输入数据段代码
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
MAIN PROC FAR
MOV AX,DATAS
MOV DS,AX
;此处输入代码段代码
AGAIN:
MOV AH,01H
INT 21H
CMP AL,0DH
JE EXIT
SUB AL,30H
CMP AL,0
JE IS1
CMP AL,1
JE IS2
CMP AL,2
JE IS3
CMP AL,3
JE IS4
CMP AL,4
JE IS5
JMP AGAIN
IS1:
CALL BUF1
JMP AGAIN
IS2:
CALL BUF2
JMP AGAIN
IS3:
CALL BUF3
JMP AGAIN
IS4:
CALL BUF4
JMP AGAIN
IS5:
CALL BUF5
JMP AGAIN
EXIT:
MOV AH,4CH
INT 21H
RET
MAIN ENDP
BUF1 PROC NEAR
MOV BX,OFFSET BUF1
CALL DISP
RET
BUF1 ENDP
BUF2 PROC NEAR
MOV BX,OFFSET BUF2
CALL DISP
RET
BUF2 ENDP
BUF3 PROC NEAR
MOV BX,OFFSET BUF3
CALL DISP
RET
BUF3 ENDP
BUF4 PROC NEAR
MOV BX,OFFSET BUF4
CALL DISP
RET
BUF4 ENDP
BUF5 PROC NEAR
MOV BX,OFFSET BUF5
CALL DISP
RET
BUF5 ENDP
DISP PROC NEAR
MOV DL,0DH
MOV AH,02H
INT 21H
MOV DL,0AH
MOV AH ,02H
INT 21H
MOV CH,4
CONTINUE:
MOV CL,4
ROL BX,CL
MOV AL,BL
AND AL,0FH
CMP AL,10
JAE ZIMU
ADD AL,30H
JMP SHUCHU
ZIMU:
ADD AL,37H
SHUCHU:
MOV DL,AL
MOV AH,02H
INT 21H
DEC CH
CMP CH,0
JNZ CONTINUE
MOV DL,0DH
MOV AH,02H
INT 21H
MOV DL,0AH
MOV AH,02H
INT 21H
RET
DISP ENDP
CODES ENDS
END MAIN
网友评论