Hi forum, I am just wondering how I could just use the last two digits of a four digit year the user inputs. For example, I want to drop the [19] from [1960] and just use the [60] which should be 3C in Hex so the registers would read it.
Here is my Data Segment.
NUMPAR LABEL BYTE
MAXLEN DB 5 ;maximum input length
ACTLEN DB ?
NUMFLD DB 8 DUP(' ')
BINFLD DW 0
MULT10 DW 1
And here is my code to accept ASCII characters from the user and convert them to digits. The user should input a four-digit year.
;To accept number.
MOV CX,0
MOV CL,MAXLEN
LEA SI,NUMFLD
CLRIN:
MOV BYTE PTR[SI],020H
INC SI
LOOP CLRIN
;
MOV MULT10,1
MOV BINFLD,0
MOV AH,0AH
LEA DX,NUMPAR
INT 21H
MOV CX,10
LEA SI,NUMFLD-1
MOV BL,ACTLEN
MOV BH,0
INPUTNXT:
MOV AL,[SI+BX]
AND AX,000FH
MUL MULT10
ADD BINFLD,AX
MOV AX,MULT10
MUL CX
MOV MULT10,AX
DEC BX
JNZ INPUTNXT
;End input.