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

> 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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.