English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need a Assembly programm that will doing this process:
Give my birth date (year, month and day) and say me how old I am now (year, month and day)?!
e.g:
Birth Date (Year): 1990
Birth Date (Month): 7
Birth Date (Day): 24
>> Now you are XX Years and XX month and XX days old.

2006-08-11 22:51:36 · 3 answers · asked by justin_coolx82 1 in Computers & Internet Programming & Design

3 answers

Hi friend check this out ;)
have fun

.MODEL SMALL
.STACK 64
.DATA
ASCTOTAL DB '000'

ADER DB '01'


YTODAY DB '00'

MTODAY DB '00'

DTODAY DB '00'

YBIRTH DB '00'

MBIRTH DB '00'

DBIRTH DB '00'

YAGE DB 2 dup(?)

MAGE DB '00'
DAGE DB '00'

FNAME DB 10 DUP (' ')
LNAME DB 10 DUP (' ')
BPLACE DB 10 DUP (' ')

PR_FNAME DB 'FIRST NAME ?','$'
PR_LNAME DB 'LAST NAME ?','$'
PR_BPLACE DB 'BIRTH PLACE ?','$'
PR_YEAR_BIRTH DB 'ENTER YEAR OF BIRTH ?','$'
PR_MONTH_BIRTH DB 'ENTER MONTH OF BIRTH ?','$'
PR_DAY_BIRTH DB 'ENTER DAY OF BIRTH ?','$'
PR_YEAR_TODAY DB 'ENTER YEAR OF DATE ?','$'
PR_MONTH_TODAY DB 'ENTER MONTH OF DATE ?','$'
PR_DAY_TODAY DB 'ENTER DAY OF DATE ?','$'

.386
.CODE

MAIN PROC FAR
MOV AX,@DATA
MOV DS,AX
MOV ES,AX
MOV DX,0000H
MOV CX,0000H
MOV AX,0600H
MOV BH,30
MOV CX,0000
MOV DX,184FH
INT 10H
MOV AH,02H
MOV BH,00H
MOV DX,0100H
INT 10H
MOV AH,09H
LEA DX,PR_FNAME
INT 21H
MOV AH,0AH
LEA DX,FNAME
INT 21H
MOV AH,02H
MOV BH,00H
MOV DX,0200H
INT 10H
MOV AH,09H
LEA DX,PR_LNAME
INT 21H
MOV AH,0AH
LEA DX,LNAME
INT 21H
MOV AH,02H
MOV BH,00H
MOV DX,0300H
INT 10H
MOV AH,09H
LEA DX,PR_BPLACE
INT 21H
MOV AH,0AH
LEA DX,BPLACE
INT 21H
MOV AH,02H
MOV BH,00H
MOV DX,0400H
INT 10H;
MOV AH,09H
LEA DX,PR_YEAR_BIRTH
INT 21H
MOV AH,0AH
LEA DX,YBIRTH
INT 21H
MOV AH,02H
MOV BH,00H
MOV DX,0500H
INT 10H
MOV AH,09H
LEA DX,PR_MONTH_BIRTH
INT 21H
MOV AH,0AH
LEA DX,MBIRTH
INT 21H
MOV AH,02H
MOV BH,00H
MOV DX,0600H
INT 10H
MOV AH,09H
LEA DX,PR_DAY_BIRTH
INT 21H
MOV AH,0AH
LEA DX,DBIRTH
INT 21H
MOV AH,02H
MOV BH,00H
MOV DX,0700H
INT 10H;
MOV AH,09H
LEA DX,PR_YEAR_TODAY
INT 21H
MOV AH,0AH
LEA DX,YTODAY
INT 21H
MOV AH,02H
MOV BH,00H
MOV DX,0800H
INT 10H
MOV AH,09H
LEA DX,PR_MONTH_TODAY
INT 21H
MOV AH,0AH
LEA DX,MTODAY
INT 21H
MOV AH,02H
MOV BH,00H
MOV DX,0900H
INT 10H
MOV AH,09H
LEA DX,PR_DAY_TODAY
INT 21H
MOV AH,0AH
LEA DX,DTODAY
INT 21H
MOV AX,0000H
CLC
LEA SI,YTODAY+1
LEA DI,YBIRTH+1
LEA BX,YAGE+1
MOV CX,02
L1: MOVZX AX,[SI]
SUB AL,[DI]
AAS
DEC SI
DEC DI
DEC BX
LOOP L1
LEA BX,YAGE+1
MOV CX,02
L2: OR BYTE PTR[BX],30H
DEC BX
LOOP L2
MOV AX,1300H
MOV BX,0031H
LEA BP,YAGE
MOV CX,02
MOV DX,0B01H
INT 10H
CLC
LEA SI,MTODAY+1
LEA DI,MBIRTH+1
LEA BX,MAGE+1
MOV CX,02
L3: MOVZX AX,[SI]
SUB AL,[DI]
AAS
DEC SI
DEC DI
DEC BX
LOOP L3
LEA BX,MAGE+1
MOV CX,02
L4: OR BYTE PTR[BX],30H
DEC BX
LOOP L4
MOV AX,1300H
MOV BX,0031H
LEA BP,MAGE
MOV CX,02
MOV DX,0C01H
INT 10H
CLC
LEA SI,DTODAY+1
LEA DI,DBIRTH+1
LEA BX,DAGE+1
MOV CX,02
L5: MOVZX AX,[SI]
SUB AL,[DI]
AAS
DEC SI
DEC DI
DEC BX
LOOP L5
LEA BX,DAGE+1
MOV CX,02
L6: OR BYTE PTR[BX],30H
DEC BX
LOOP L6
MOV AX,1300H
MOV BX,0031H
LEA BP,DAGE
MOV CX,02
MOV DX,0D01H
INT 10H
MOV AH,08H
INT 21H
MOV AH,00H
MOV AL,02H
INT 10H
MOV AX,4C00H
INT 21H
MAIN ENDP
END MAIN

2006-08-15 02:47:26 · answer #1 · answered by Justin cool 2 · 0 0

Some good free tools for programming, including assemblers and tutorials can be found at the URL below. It may help you with what you want.

2006-08-12 11:33:48 · answer #2 · answered by griz803 5 · 0 0

Just subtract birthdate from today's date. You dont say what processor you are running it on, so I cant give assembly code.

2006-08-12 09:16:49 · answer #3 · answered by justme 7 · 0 0

fedest.com, questions and answers