Из древнего| Код | ; This procedure checks the decimal number from the first digit after ; DS:[SI] and returns the HEX result in AX. ; If OUT-OF-RANGE (the number is greater than 65535) occured, ; CARRY flag is set, the content of AX is unpredictable.
IFNDEF <ASK_NUM_16>
IF_NOT_DIGIT MACRO destination CMP AL'0' JB destination CMP AL,'9' JA destination ENDM
IF_DIGIT MACRO destination LOCAL dummy_label IF_NOT_DIGIT dummy_label JMP destination dummy_label: ENDM
ASK_NUM_16 PROC NEAR PUSH DX CLD FIND_FIRST_16: LODSB IF_NOT_DIGIT FIND_FIRST_16 XOR AH,AH MOV DX,AX FIND_NEXT_16: LODSB IF_NOT_DIGIT DONE_16 SUB AL,30H XOR AH,AH PUSH AX MOV AX,0AH MUL DX CMP DX,0 JNE OUT_OF_RANGE_16 POP DX ADD DX,AX JNC FIND_NEXT_16 OUT_OF_RANGE_16:LODSB IF_DIGIT OUT_OF_RANGE_16,DUMMY_LABEL_16 POP DX STC JMP RETURN_16 DONE_16: CLC MOV AX,DX RETURN_16: POP DX RETN ASK_NUM_16 ENDP
ENDIF
|
|