?
Solved

PowerPC Assembler

Posted on 1997-01-05
1
Medium Priority
?
1,564 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
gregj earned 400 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

752 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