This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: poke function ....


At 1:25 PM -0400 9/21/98, Dony wrote:
>If it is the case, the assembler pokeb suppose to be like this :
>
>		move.l  4(%sp),%a0      /* get base_addr */
>		swap	%a0		/* exchange 16 bit halves, so that
>later on */
>					/* address will be base_addr+offset */
>		add.l   8(%sp),%a0      /* add offset */
>		move.b  15(%sp),(%a0)   /* move data byte */
>		rts

nope, you don't need to swap anything.
and if you really need the separate address
and offset, just include it in the C code:

	pokeb(char *base, int offset, char data)
	{
		base[offset] = data;
	}

better yet, use gcc's -S flag and you can look at the
assembly language output of the compiler

r