写一个 C 程序输入是 MIPS 汇编语言 (mal) 程序和输出是带有行号和/或不符合程序的交叉引用表的不良程序 15
CODE SEGMENT
ASSUME CS:CODE
MAIN PROC FAR
START:
CALL DEC_BIN
CALL BIN_HEX
call dec_bin1
call BINIDEC
MOV AH,4CH
INT 21H
RET
MAIN ENDP
DEC_BIN PROC NEAR
MOV BX,0
GET_CHAR:MOV AH,1
INT 21H
CMP AL,0DH
JE EXIT
SUB AL,30H
JL EXIT
CMP AL,9
JG EXIT
CBW
XCHG AX,BX
MOV CX,10
MUL CX
XCHG AX,BX
ADD BX,AX
JMP GET_CHAR
EXIT:
mov dl,0ah
mov ah,2
int 21h
RET
DEC_BIN ENDP
BIN_HEX PROC NEAR
MOV CH,4
ROTATE:MOV CL,4
ROL BX,CL
MOV AL,BL
AND AL,0FH
ADD AL,30H
CMP AL,3AH
JL DISPLAY
ADD AL,7H
DISPLAY:MOV DL,AL
MOV AH,2
INT 21H
DEC CH
JNZ ROTATE
mov dl,0ah
mov ah,2
int 21h
RET
BIN_HEX ENDP
DEC_BIN1 PROC NEAR
MOV BX,0
GET_CHAR1:MOV AH,1
INT 21H
CMP AL,0DH
JE EXIT1
SUB AL,30H
JL EXIT1
CMP AL,9
Jle t0
SUB AL,7H
CMP AL,15
jg exit1
t0:CBW
XCHG AX,BX
mov cl,4
rol ax,cl
ADD BX,AX
JMP GET_CHAR1
EXIT1:mov dl,0ah
mov ah,2
int 21h
RET
DEC_BIN1 ENDP
BINIDEC PROC NEAR
MOV CX,1000
CALL DEC_DIV
MOV CX,100
CALL DEC_DIV
MOV CX,10
CALL DEC_DIV
MOV CX,1
CALL DEC_DIV
RET
BINIDEC ENDP
DEC_DIV PROC NEAR
MOV AX,BX
MOV DX,0
DIV CX
MOV BX,DX
CMP AL,9
ADD AL,30H
MOV DL,AL
MOV AH,2
INT 21H
RET
DEC_DIV ENDP
CODE ENDS
END START
这不是C写的啊T_T