让用户输入字符后,如何将ASCII码转换成二进制再操作,求高手啊
这是我刚编的一个程序,就是让用户自己输入X,Y的值,然后判断它在第几象限,轴上默认为K=0,输入的时候老师说电脑上存的是它的ASCII码,就不能直接这样比了,要先把ASCII码转为二进制的,可是要怎么转呢,请高手帮忙DATA SEGMENT
STR1 DB 'Please input X',0DH,0AH,'$'
STR2 DB 'Please input Y',0DH,0AH,'$'
D0 DB 'K is 0',0DH,0AH,'$'
D1 DB 'K is 1',0DH,0AH,'$'
D2 DB 'K is 2',0DH,0AH,'$'
D3 DB 'K is 3',0DH,0AH,'$'
D4 DB 'K is 4',0DH,0AH,'$'
X DB 20
DB ?
DB 20 DUP(?)
Y DB 20
DB ?
DB 20 DUP(?)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,ES:DATA
START: MOV AX,DATA
MOV DS,AX
MOV ES,AX
LEA DX,STR1
MOV AH,9
INT 21H
LEA DX,X
MOV AH,0AH
INT 21H
MOV BX,DX
LEA DX,STR2
MOV AH,9
INT 21H
LEA DX,Y
MOV AH,0AH
INT 21H
MOV CX,DX
CMP BX,0
JZ K0
CMP CX,0
JZ K0
JG K12
CMP BX,0
JG K4
LEA DX,D3
MOV AH,9
INT 21H
JMP EXIT
K0: LEA DX,D0
MOV AH,9
INT 21H
JMP EXIT
K4: LEA DX,D4
MOV AH,9
INT 21H
JMP EXIT
K12: MOV BX,0
JG K1
LEA DX,D2
MOV AH,9
INT 21H
JMP EXIT
K1: LEA DX,D1
MOV AH,9
INT 21H
EXIT: MOV AH,4CH
INT 21H
CODE ENDS
END START