0 Replies - 199 Views - Last Post: 13 October 2018 - 07:17 PM Rate Topic: -----

#1 DreamZ98   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 13-October 18

How to add day to the end of the month assignment?

Posted 13 October 2018 - 07:17 PM

As of now, I am working on a program in which the user inputs a specific date such as 01/17/1999 and must get an output like January 17,1999. As of now my code works for the month part but I am having trouble receiving the number from a parallel array which represents the length of my month and has the index for the end of the month in which i want to add my date number into.

Here is my code so far:
	
	lineout userr
	linein buff
	
	cvta2 date,#2   
	move.l D0,D1 
	subi.l #1,D1    
	
	move.l D1,D2     
	muls #1,D2 
	
	
	muls #11,D1     
	lea  months,A1
	adda D1,A1
	
	
	move.b 0(A1),rest+0
	move.b 1(A1),rest+1
	move.b 2(A1),rest+2
	move.b 3(A1),rest+3
	move.b 4(A1),rest+4
	move.b 5(A1),rest+5
	move.b 6(A1),rest+6
	move.b 7(A1),rest+7
	move.b 8(A1),rest+8
	move.b 9(A1),rest+9
	move.b 10(A1),rest+10
	move.b 11(A1),rest+11
	
	
	
	
	*Day part
	
	
	lea length,A2
	adda D2,A2 
	
	move.b (A2),D3
	adda D3,A4
	
	
		
	
	
	move.b date+3,output+0(A4)  
	move.b date+4,output+1(A4)
	
	
	
	
	
	
	
	
	 
	  
	
	 
	
	
	

	lineout datest
	

        break                   * Terminate execution
*
*----------------------------------------------------------------------
*       Storage declarations


userr:  dc.b 'Enter a date in MM/DD/YYYY format:',0
buff:   ds.b       80	*Stores 80 bytes for storage for user input
datest: dc.b 'The date entered is '
rest:   ds.b       80    *where we will construct all of the output on. 
months: dc.b 'January ',0,0,0  *index 0
	dc.b 'February ',0,0	*index 1
	dc.b 'March ',0,0,0,0,0  *index 2
	dc.b 'April ',0,0,0,0,0	*index 3
	dc.b 'May ',0,0,0,0,0,0,0 *index 4
	dc.b 'June ',0,0,0,0,0,0 *index 5
	dc.b 'July ',0,0,0,0,0,0 *index 6
	dc.b 'August ',0,0,0,0   *index 7
	dc.b 'September ',0      *index 8
	dc.b 'October ',0,0,0    *index 9
	dc.b 'November ',0,0     *index 10
	dc.b 'December ',0,0     *index 11
	

length:   dc.b 8	*January's length
	  dc.b 9       	*February's length
	  dc.b 6    	*March's length
	  dc.b 6     	*April's length
	  dc.b 4  	*May length
	  dc.b 5        *June's length
	  dc.b 5       *July's length
	  dc.b 7        *August's length
	  dc.b 10       *September's length
	  dc.b 8      *October's length
	  dc.b 9       *November's length
	  dc.b 9        *December's length
	
:code:

My issue is that when i do move.b buff+3,output+0(A4), nothing prints out for the day. It's just a blank space. How do i access values form the length array so i can do move.b buff+,output+(that number from the length array)?

This post has been edited by modi123_1: 14 October 2018 - 02:00 AM
Reason for edit:: In the future please use the [code] tag button in the editor


Is This A Good Question/Topic? 0
  • +

Page 1 of 1