Solved

PowerPC Assembler

Posted on 1997-01-05
1
1,513 Views
Last Modified: 2013-12-26

I am trying to inline PPC assembler with Codewarrior 10 - but not the way it's normally done with CodeWarrior (without a function call if possible) and cannot figure out how to do it  Specifically, in the 68k world, I can use the following with no problems:

#pragma parameter SwitchStack(__A0)
extern void SwitchStack(SR *sr) =
{
    0x2178, 0x0BAE, 0x0010,
    .
    .
    .
    0x2E68, 0x0004
};

The call to SwitchStack is placed in my code and I switch stacks.  Later I restore my stack with another inline assembler routine.  I found the basis for this routine for the 68k on AppleLink years ago. The "classic" way to
inline code messes up the link register.  Is there an equivalent SwitchStack routine for the PowerPC that matches what the switch stack for the 68k does?

Thanks for your help,

Charles Copeland
Useful Software, Inc.

0
Comment
Question by:charles122996
1 Comment
 

Accepted Solution

by:
gregj earned 200 total points
ID: 1291400
CodeWarrior doesn't support what you are trying to do. The opcode inline style function is not supported by the PowerPC C or C++ compilers. And the PowerPC compilers don't allow you to specify which registers are used for parameters. See "Inside CodeWarrior 10," CL-38.

The PowerPC compilers do support inlined asm functions, but because they are real functions the compiler will determine register usage, and the link register is set before your code is entered. This is implied by the requirement documented on page CL-112 that every PowerPC assembly function must end in a "blr" instruction.

Even if all of these obstacles could be overcome somehow, the PowerPC optimizer would likely confound all of your efforts, and you'd have to make a lot of assumptions about what the compiler and optimizer will do.

Metrowerks has said publicly that they don't intend to support inlined blocks of assembly code in either the 68K or PowerPC compilers.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now