LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-09-2004, 10:21 AM   #1
Annie0716
LQ Newbie
 
Registered: Jul 2004
Posts: 10

Rep: Reputation: 0
Unhappy Who can help me to solve this problem?


I am trying to test my asm code, but I met a strange problem. I have two codes, the only one difference between them is the first one caculate two numbers and the later does four. But the results of them are so different. The first one can run, but the second died.

Since I do this in an embedded enviroment, and I lack the debugging experience under it, so could anyone help me on this problem£¿
What is the problem?

Thank you very much!

1st:
__asm__("
move.l #0x00000080, %%MACSR;
move.w #0x00, %%CCR;

move.l %1, %%a0; /*win_cos_l*/
move.l %2, %%a1; /*out*/

/*add.l #2448, %%a0;
add.l #68, %%a1;*/

move.l #18, %%d0; /*counter*/

LOOP_ONE:
move.l #0,%%acc;
move.l %3,%%a2; /*in*/

move.l (%%a0),%%a3; /*1st cycle*/
move.l (%%a2),%%d3;
mac.l %%d3, %%a3;
move.l (4,%%a0),%%a4;
move.l (4,%%a2),%%d4;
mac.l %%d4, %%a4;
/*move.l (8,%%a0),%%a5;
move.l (8,%%a2),%%d5;
mac.l %%d5, %%a5;
move.l (12,%%a0),%%a6;
move.l (12,%%a2),%%d6;
mac.l %%d6, %%a6;*/

move.l %%acc, %%d1;
move.l %%d1, (%%a1);

subi.l #1, %%d0;
bne LOOP_ONE;
"
:"=m" ((out))
:"r" (win_cos_l),"r"(out),"r"(in));

2nd:
__asm__("
move.l #0x00000080, %%MACSR;
move.w #0x00, %%CCR;

move.l %1, %%a0; /*win_cos_l*/
move.l %2, %%a1; /*out*/

/*add.l #2448, %%a0;
add.l #68, %%a1;*/

move.l #18, %%d0; /*counter*/

LOOP_ONE:
move.l #0,%%acc;
move.l %3,%%a2; /*in*/

move.l (%%a0),%%a3; /*1st cycle*/
move.l (%%a2),%%d3;
mac.l %%d3, %%a3;
move.l (4,%%a0),%%a4;
move.l (4,%%a2),%%d4;
mac.l %%d4, %%a4;
move.l (8,%%a0),%%a5;
move.l (8,%%a2),%%d5;
mac.l %%d5, %%a5;
move.l (12,%%a0),%%a6;
move.l (12,%%a2),%%d6;
mac.l %%d6, %%a6;

move.l %%acc, %%d1;
move.l %%d1, (%%a1);

subi.l #1, %%d0;
bne LOOP_ONE;
"
:"=m" ((out))
:"r" (win_cos_l),"r"(out),"r"(in));
 
Old 08-09-2004, 11:03 AM   #2
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
tho i have no clue what that says, i do must wonder, what asm code is it for (the target CPU) as it appears quite different from what i learned for 8086
 
Old 08-09-2004, 07:59 PM   #3
Annie0716
LQ Newbie
 
Registered: Jul 2004
Posts: 10

Original Poster
Rep: Reputation: 0
It' s for MCF5249, a MOTOROLA MCU. Different syntax from the asm of Intel on 8086.

The instruction mac means multiply and accumulation and 'l' means longword.

Could anyone give me a help on my problem?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I need help to solve this problem TheTiger Fedora 1 10-26-2005 01:01 PM
help..how i can solve this problem?// TAAN Linux - General 2 02-16-2005 07:53 AM
I don't know how to solve a problem in C nostrum Programming 5 07-20-2004 07:57 AM
No one can solve my problem Sundance Linux - Newbie 5 12-08-2003 01:13 PM
The only problem I couldn't solve... Bager Linux - Laptop and Netbook 2 07-21-2003 08:37 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration