1 Replies - 2449 Views - Last Post: 13 November 2012 - 07:08 AM

#1 BubbaBolt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 21-November 11

Address Error at instruction before address

Posted 05 November 2012 - 07:58 PM

I am writing a program for my Motorola M68k assembly class that is suppose to output a day of the week given a user inputted date. My program assembles fine but when I try running the program it allows me to enter a date, but I keep getting a message that says "Address error at instruction before address 000030F8". When I go to the program listing file, the instructions before address 000030F8 are the "lea days,A1" and "adda.l D2,A1" commands. I do not know why I keep getting that error message. Any guidance on how to correct this problem will be greatly appreciated.



start:  initIO                  * Initialize (required for I/O)
	setEVT			* Error handling routines
*	initF			* For floating point macros only	
	
	lineout		title
	lineout		prompt
	linein		buffer
	cvta2		buffer,#2
	move.l		D0,D1
	cvta2		buffer+3,#2
	move.l		D0,D2
	cvta2		buffer+6,#4		
	move.l		D0,D3
	
	*** a = (14-month)/12
	move.l		#14,D4
	sub.l		D1,D4
	ext.l		D4
	divs		#12,D4
	
	***y = year - a 
	move.w		D3,D5
	sub.w		D4,D5
	
	***m = month+12a-2
	move.l		#12,D6
	muls		D4,D6
	add.l		D1,D6
	subq.l		#2,D6
	
	***d = (day+y+y/4-y/100+y/400+31m/12)mod 7
	move.l		D5,D4
	move.l		D5,D3
	move.l		D5,D1
	ext.l		D4
	divs		#4,D4
	ext.l		D3
	divs		#100,D3
	ext.l		D1
	divs		#400,D1
	muls		#31,D6
	ext.l		D6
	divs		#12,D6
	add.l		D5,D2
	add.l		D4,D2
	add.l		D3,D2
	add.l		D1,D2
	add.l		D6,D2
	ext.l		D2
	divs		#7,D2
	swap		D2
	muls		#12,D2
	lea		days,A1
	adda.l		D2,A1
	move.l		(A1)+,day
	move.l		(A1)+,day+4
	move.l		(A1)+,day+8
	clr.b		(A1) 	
	lineout		answer

	

        break                   * Terminate execution
*
*----------------------------------------------------------------------
*       Storage declarations
	title:	dc.b	'Program #2, Gerald Leininger, masc1401',0
	prompt:	dc.b	'Please enter a date (mm/dd/yyyy):',0
	buffer:	ds.b	80
	answer: dc.b	'The day of the week is'
	day:	ds.b	12
	days:	dc.b	'Sunday.',0
		dc.b	'Monday.',0
		dc.b	'Tuesday.',0
		dc.b	'Wednesday.',0
		dc.b	'Thursday.',0
		dc.b	'Friday.',0
		dc.b	'Saturday.',0
        end



Is This A Good Question/Topic? 0
  • +

Replies To: Address Error at instruction before address

#2 turboscrew  Icon User is offline

  • D.I.C Addict

Reputation: 100
  • View blog
  • Posts: 644
  • Joined: 03-April 12

Re: Address Error at instruction before address

Posted 13 November 2012 - 07:08 AM

Does anyone know where to find a good manual for
the BSVC microprocessor simulation framework?

Or maybe someone knows about the BSVC-macros, like "cvta2"?

@BubbaBolt: What did you fed in as input?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1