Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 14th, 2013, 10:06 AM   #1
kayxxx
Newbie
 
Join Date: Feb 2013
Posts: 6
Rep Power: 0 kayxxx is on a distinguished road
theres something wrong?

Please someone help me with my problem i have a very hard time to do this languag.. an assembly language program which allows the user to input a number of years (from 1 to 30) and then tells the user how many months, weeks, days, hours and minutes are there in that number of years

Example 1: Input: Number of years: 1
Output:
Months: 12
Weeks: 52
Days: 365
Hours: 8760
Minutes: 525600

i think my program is very wrong please help me to do this.. check my codes..

.MODEL SMALL
.STACK 1000
.DATA

msg1 DB 13,10,"Input number of years: ","$"
MSG2 DB 13,10,"Number of Weeks: $"
MSG3 DB 13,10,"The sum is: ","$"

NUM1 db ?

.CODE

MAIN PROC NEAR

MOV AX, @DATA
MOV DS, AX

; get first number
mov DX, offset MSG1
MOV AH, 09h
INT 21h

MOV AH, 01
INT 21H
SUB AL, '0'

MOV BL, AL

MOV AH, 01
INT 21H
SUB AL, '0'

MOV CL, AL


mov dx, offset msg2

mul cl,12
int 21h
Exit:
mov cx, 42ch
int 21h


MAIN ENDP
END MAIN

Last edited by kayxxx; Feb 14th, 2013 at 10:20 AM.
kayxxx is offline   Reply With Quote
Old Feb 14th, 2013, 11:14 AM   #2
Adak
Hobby Coder
 
Join Date: May 2006
Posts: 1,181
Rep Power: 13 Adak will become famous soon enough
Re: help me please!!

Wow! Someone coding in Assembly.

I know we have a forum for it, but it's rare to see someone actively working there. Does anyone here actually code in assembly?

You might get an answer, but I'd repeat this question, on a forum that specializes in Assembly, just to be sure it gets at least one answer.
Adak is offline   Reply With Quote
Old Feb 14th, 2013, 1:25 PM   #3
sixstringartist
Programming Guru

 
Join Date: Jun 2005
Posts: 1,333
Rep Power: 14 sixstringartist will become famous soon enough
Re: help me please!!

Quote:
Originally Posted by Adak View Post
Does anyone here actually code in assembly?
The Dark and I seem to be the only ones who respond to posts here.

@OP
Your code is is very incomplete, and does not match up with the problem you have been given.

For example, you have two messages that ask the user for input yet the problem only states to ask for one input which is the number of years.

Then you have two interrupts to input a character:
MOV AH, 01
INT 21H
SUB AL, '0'

MOV BL, AL

MOV AH, 01
INT 21H
SUB AL, '0'

MOV CL, AL

I can only assume you have limited yourself to 2 digits of a year as input. You should either use service 0A of int 21h to take in buffered input, or loop over your character input (unless you know for certain that your input is limited to 2 digits).

After that your program pretty much stops so saying you "think" its wrong is an understatement, as its incomplete.

After you have the input you need to convert from ASCII characters to an integer, do the math to find your values (beware of overflows), and convert your results to ascii strings to be printed out.
sixstringartist is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:59 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC