oops...
you should pass a copy size to memcpy() as third parameter.
I passed 3.
From the output I see everything is correct:
main:
/* prologue: frame size = 6 */
.L__FrameSize_main=0x6
.L__FrameOffset_main=0x6
mov #(__stack-6), r1
/* prologue end (size=2) */
;; allocate test structure on stack
mov.b #llo(1), @r1 ; load 0x01
mov.b #llo(2), 1(r1) ; load 2
mov.b #llo(3), 2(r1) ; load 3
mov r1, r15 ;
add #llo(4), r15 ; prepare destination pointer
mov r1, r14 ; load r14 with a pointer to test.data
add #llo(1), r14 ; skip 'first' in test.data
mov.b @r14+, 4(r1) ; copy this.
mov.b @r14+, 1(r15) ; three
mov.b @r14+, 2(r15) ; times
/* epilogue: frame size=6 */
add #6, r1
br #__stop_progExec__
/* epilogue end (size=4) */
/* function main size 23 (17) */
On Tuesday 03 February 2004 12:29, G Halkes wrote:
> I've attached a file that should show you the problem.
> You will have to make sure printf works (hence the
> include printf.h). Since we use a custom built OS
> here, and I haven't looked into writing a program
> without it I can't say I've tested this, but I'm sure
> you can work it out from the code attached.
>
> The correct output would be 302 302 302.
>
> G. Halkes
>
> --- Dmitry <[email protected]> wrote:
> > Ok, I'll check this.
> > a snippet of a complete code will help greatly :)
> > ~d
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!
> http://webhosting.yahoo.com/ps/sb/
--
/*****************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) State Polytechnical Univ.
(_Y_.)' ._ ) `._ `. ``-..-' Radio-Physics Departament
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 5403923, 5585314
*****************************************************************/