GIDForums  

Go Back   GIDForums > Computer Programming Forums > Assembly Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 17-Nov-2007, 00:46
lilnaniam lilnaniam is offline
New Member
 
Join Date: Nov 2007
Posts: 3
lilnaniam is on a distinguished road
Question

Assembly Language - Arrays


I am a beginner and am trying to display the current date. So far I have this but it just keeps printing Sunday which is the first entry in the "DayName" array. I am trying to get the current date from the system to display. Can anyone direct me in what I am doing wrong.
Heres my code...if need to see my macro file let me know.

Code:
.DATA Day_length EQU 11 DayName DB 'Sunday.$ ', 'Monday.$ ', 'Tuesday.$ ', 'Wednesday.$' , 'Thursday.$ ', 'Friday.$ ', 'Saturday.$ ' Message DB 'Today is $' .CODE main PROC _initreg _showText Message _initreg _GetDate mov bl, Day_length imul bl mov ax, OFFSET DayName _showDay DayName _endProg

Any help in the right direction would be appreciated!!
  #2  
Old 17-Nov-2007, 07:31
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 6,153
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Assembly Language - Arrays


Quote:
Originally Posted by lilnaniam
it just keeps printing Sunday

What do you think that these three instructions do?
Code:
mov bl, Day_length imul bl mov ax, OFFSET DayName

Here's what I think they do, but I cant test, since I have no way (and no desire) to assemble and execute them.

1. Put the decimal number 11 into the 8-bit register bl.

2. Multiply the contents of the 8-bit register al by the contents of the 8-bit register bl and store the 16-bit result in ax, which consists of ah:al.

3. Put the value of the symbol DayName (the address of the first character in the string 'Sunday.$ ') into the register ax.

Is that what you had in mind?

Regards,

Dave
  #3  
Old 17-Nov-2007, 10:31
lilnaniam lilnaniam is offline
New Member
 
Join Date: Nov 2007
Posts: 3
lilnaniam is on a distinguished road

Re: Assembly Language - Arrays


Quote:
Originally Posted by davekw7x
What do you think that these three instructions do?
Code:
mov bl, Day_length imul bl mov ax, OFFSET DayName

3. Put the value of the symbol DayName (the address of the first character in the string 'Sunday.$ ') into the register ax.

Is that what you had in mind?

Regards,

Dave

Ahhh....I see what I did wrong there it should be " add ax, OFFSET Dayname" . Thanks you for catching that. But now I am having problems displaying that. I know now that I some how need to send the ax register to my _showtext or create a new macro because the _showtext macro is:

Code:
_showDay MACRO strText lea dx, strText mov ah, 09h int 21h ENDM
It is messing up the ax register before displaying. I do see that by the line _showDay DayName....is only taking the first value in the array. Thats why my result is always sunday. I need to direct it to the ax register. Do I need to possibly store it in the [si] or [di]? And create a new macro?
  #4  
Old 17-Nov-2007, 11:15
lilnaniam lilnaniam is offline
New Member
 
Join Date: Nov 2007
Posts: 3
lilnaniam is on a distinguished road

Re: Assembly Language - Arrays


Ahhh....I got it working....I saved it to another variable and created a new macro that looks like so:
Code:
_showDay MACRO text mov dx, text mov ah, 09h int 21h ENDM
Thanls for helping!!
  #5  
Old 27-Apr-2008, 16:19
mwasim22 mwasim22 is offline
New Member
 
Join Date: Apr 2008
Posts: 1
mwasim22 is on a distinguished road

Re: Assembly Language - Arrays


hii illinum

dear im a very beginner in assembly
my project is to show date and time is assembly language masm 6 using simples coding
can u plz help me in this matter??
my id is mwasim22@yahoo.com
u can contact me there
plz reply me as soon as u can!
m really waiting for ur reply!!
regards!
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Program Not working, assembly language czerdrill Assembly Language 1 28-Oct-2007 14:13
Please help me with assembly language! czerdrill Assembly Language 0 20-Oct-2007 13:13
Assemblers & assembly language BlueFireCO. Assembly Language 2 26-Mar-2007 09:56
which language ? onauc C++ Forum 2 19-Nov-2004 02:53

Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 03:26.


vBulletin, Copyright © 2000 - 2014, Jelsoft Enterprises Ltd.