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 363,829 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 4,125 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:
Views: 299 | Replies: 1
Reply
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  
Join Date: Dec 2005
Posts: 2,919
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 18
Solved Threads: 322
Colleague
Salem's Avatar
Salem Salem is offline Offline
void main'ers are DOOMed

Re: mc68k add integers

  #2  
May 11th, 2008
> I can see from the screen dump that d0 contains A
And that is the same as 10 decimal.

Perhaps read the documentation to find out what other services those trap #14's offer.

If there is nothing, then you'll have to convert the number to a printable string yourself.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

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

 

DaniWeb Assembly Marketplace
Thread Tools Display Modes

Other Threads in the Assembly Forum

All times are GMT -4. The time now is 12:16 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC