User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 426,483 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,171 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser: Programming Forums

mc68k add integers

Join Date: May 2008
Posts: 1
Reputation: lozzam is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
lozzam lozzam is offline Offline
Newbie Poster

mc68k add integers

  #1  
May 11th, 2008
Hello

If I add two numbers say, 5 and 5 to equal 10 .
I can see from the screen dump that d0 contains A
How do I go about converting A so as to display the number 10 on the screen? I guess I have to convert to ascii value, but dont know how to do this
start	org	$1000

	move.l	#$7ffe,sp	;init stack pointer

	sub.l	#4,sp	;stack space fr answer

	move.w	#5,-(sp)	;push parameter 1

	move.w	#5,-(sp)	;push parameter 2

	bsr	addit	;go to addit

	add.l	#4,sp	;remove parameters

	move.l	(sp)+,ans	;pop result into ans

	move.l	ans,d0	;

	
	move.l	#248,d7	;to display 

	trap	#14	;

	move.b	#228,d7	;ready to exit

	trap	#14	;done


addit	move.w	4(sp),d0	;get parameter 2

	move.w	6(sp),d1	;get parameter 1

	add	d0,d1	;add

	move.l	d1,8(sp)	;result on the stack

	rts		;return to caller

ans	ds.l	1	;space for answer

	end
Last edited by Narue : May 11th, 2008 at 8:58 am. Reason: Added code tags
AddThis Social Bookmark Button
Reply With Quote  
All times are GMT -4. The time now is 4:33 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC