Welcome, Guest. Please login or register.

Author Topic: PowerPC asm programming  (Read 7868 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline fatman2021Topic starter

  • Full Member
  • ***
  • Join Date: Dec 2002
  • Posts: 118
    • Show only replies by fatman2021
    • http://www.geocities.com/fatman2021/
PowerPC asm programming
« on: February 25, 2003, 07:32:59 PM »
I'm a x86 programmer.  So when I do my asm programming I use the x86 8-bit, 16-bit, and 32-bit registers. Now what I need to know is the PowerPC  equivalents of the x86 8-bit, 16-bit, and 32-bit registers. This will help me port my x86 VESA VBE programs over to AmigaOS. So if any one knows a table or any other infomation, let me know thanks
I also need to know the PowerPC equivalent to the x86 interrupt 10h
 

Offline xeron

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 2533
    • Show only replies by xeron
    • http://www.petergordon.org.uk
Re: PowerPC asm programming
« Reply #1 on: February 25, 2003, 07:58:28 PM »
The PowerPC has 32 64bit integr registers, which can be used as 8, 16, 32 or 64bit depending on what you specify with the instruction. They are named R0 to R31.

It also has 32 floating point registers. I can't remember if these are internally 64 or 80bits wide, you'll have to look that up.

There is no "PowerPC equivalent of interrupt 10h". Interrupt 10h is not an "x86" thing, its an "MS-DOS" thing, and the calls to set up displays will be totally different in other operating systems, even under x86.

For setting up and using displays under AmigaOS, may I recommend purchasing the Amiga DevCD v2.1, which contains a lot of documentation for all the Amiga's APIs. Also, consult the developer guide for Picasso96, which will detail things like highcolour and truecolour modes.

I suggest you get some free books from motorola. I can't remember the URL where you order them, but they're totally free including postage.
Playstation Network ID: xeron6
 

Offline Ami603

  • Full Member
  • ***
  • Join Date: Jul 2002
  • Posts: 180
    • Show only replies by Ami603
Re: PowerPC asm programming
« Reply #2 on: February 25, 2003, 08:29:59 PM »
AmigaOne X1000
 

Offline fatman2021Topic starter

  • Full Member
  • ***
  • Join Date: Dec 2002
  • Posts: 118
    • Show only replies by fatman2021
    • http://www.geocities.com/fatman2021/
@Tickly
« Reply #3 on: February 25, 2003, 08:59:15 PM »
Interrupt 10h is not a msdos thing... It's a x86 video biso thing.
 

Offline Hardboy

  • Full Member
  • ***
  • Join Date: Feb 2002
  • Posts: 248
    • Show only replies by Hardboy
Re: PowerPC asm programming
« Reply #4 on: February 25, 2003, 09:08:00 PM »
This won´t - unfortunately - be possible. VESA VBE is a standard for X86 BIOS, and does not exsist in PowerPC world.. Nor does simple mapping of register have any use.

If you though, still wan´t to learn PowerPC asm to write amiga apps, let us know. We can direct you to the needed manuals..
 

Offline Crumb

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 1786
  • Country: 00
    • Show only replies by Crumb
    • http://cuaz.sourceforge.net
Re: PowerPC asm programming
« Reply #5 on: February 25, 2003, 10:57:42 PM »
go to mot.com and you'll find all the information you need about ppc asm programming...
If you want to port your programs thank you, but programming a pc with x86 and an amiga has little in common. You'll have to use the OS to select the screenmode. In amiga you can have any resolution and it has a different ID. In Amiga you can have multiple "screens" and the address of the screen can be in any place of the gfx ram, it's not in a fixed position, so you again will need to use the OS to get that address if you plan to write directly to the gfx ram for example.

Don't fancy about porting your apps without learning a bit how the AmigaOS API works. This is not a pc with MSDOS... this is not a primitive 8bit computer...

 If you are going to port programs and not games you shouldn't "draw" the interface writing to the gfx card, you should use the components of the OS.
The only spanish amiga news web page/club: Club de Usuarios de Amiga de Zaragoza (CUAZ)
 

Offline fatman2021Topic starter

  • Full Member
  • ***
  • Join Date: Dec 2002
  • Posts: 118
    • Show only replies by fatman2021
    • http://www.geocities.com/fatman2021/
Re: PowerPC asm programming
« Reply #6 on: February 26, 2003, 12:56:23 AM »
The only computer I have at this time is a IBM ThinkPad 755CX with a P75 CPU. So I have no way to test my PowerPC apps
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: PowerPC asm programming
« Reply #7 on: February 26, 2003, 09:59:53 AM »
Quote

Tickly wrote:
The PowerPC has 32 64bit integr registers, which can be used as 8, 16, 32 or 64bit depending on what you specify with the instruction. They are named R0 to R31.
It also has 32 floating point registers. I can't remember if these are internally 64 or 80bits wide, you'll have to look that up.


AFAIK, the integer register set are only 32-bits wide on 60x, 64-bit on G3 and above. Still, not sure, so don't take my word for it.

The FPU regs are 64-bit IEEE754 compatible, but I think the internal calculation goes higher.
int p; // A
 

Offline AmiDog

  • Jr. Member
  • **
  • Join Date: Feb 2002
  • Posts: 62
    • Show only replies by AmiDog
    • http://www.amidog.com
Re: PowerPC asm programming
« Reply #8 on: February 26, 2003, 10:25:03 AM »
All motorola 7xxx (G4), 7xx (G3) and 6xx (G2) processors in production are 32-bit implementations according to their website and thus, I assume, have 32-bit integer registers.
 

Offline xeron

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 2533
    • Show only replies by xeron
    • http://www.petergordon.org.uk
Re: PowerPC asm programming
« Reply #9 on: February 26, 2003, 10:31:08 AM »
heh, ok. I sit corrected  :-D
Playstation Network ID: xeron6
 

Offline EntilZha

  • Full Member
  • ***
  • Join Date: Feb 2002
  • Posts: 131
    • Show only replies by EntilZha
    • http://www.hyperion-entertainment.com
Re: PowerPC asm programming
« Reply #10 on: February 26, 2003, 11:11:20 AM »
>The PowerPC has 32 64bit integr registers

Actually, these registers are only 32 bit on a 32 bit PPC...
- Thomas
Avatar by Karlos
 

Offline xeron

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 2533
    • Show only replies by xeron
    • http://www.petergordon.org.uk
Re: PowerPC asm programming
« Reply #11 on: February 26, 2003, 11:17:59 AM »
OK OK thats enough corrections :) I've already admitted to being wrong.
Playstation Network ID: xeron6
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: PowerPC asm programming
« Reply #12 on: February 26, 2003, 12:38:37 PM »
Quote

fatman2021 wrote:
I'm a x86 programmer.  So when I do my asm programming I use the x86 8-bit, 16-bit, and 32-bit registers. Now what I need to know is the PowerPC  equivalents of the x86 8-bit, 16-bit, and 32-bit registers. This will help me port my x86 VESA VBE programs over to AmigaOS. So if any one knows a table or any other infomation, let me know thanks
I also need to know the PowerPC equivalent to the x86 interrupt 10h


A couple of things here, the PPc does not have 8bit,16bit and 32bit modes, instead it had a single set of 32, 32bit general purpose registers which will work in the size of the addressing mode of the instruction you are using.. Some registers are reserved for use by the OS (some registers don;t get saved in a context* switch,), and this depends on the OS you are using, so get a good book on the subject.

*Linux, BFD, MacOSX, AmigOS4,MorphOS and AROS are all multitasking OS's, so you must remember that your task is going to not going to have total control over the CPU and will be switched out quite regularly.

Doue to the design of MSDOS, System calls had to made made using an interupt, thus System calls and Interupt have become interchangeable for the MSDOS programmer.
This is not the case for Multitasking OS's, and system calls should not be confused with interupts. you will probably never need to invoke an interupt in AmigaOS.
AmigaOS has a dedicated graphics subsystem called, strangly enough, the graphics.library which as a programmer you probably won't need very much. It is more common now to use the GUI system known as the intuition.library. This provides the programmer full graphics functions but keeps them in the context of the GUI, which users and graphics cards like!
I suggest you buy/download some developer docs, AmigaOS is very different to MSDOS.
I would also suggest you forget about PPC asm (porting x86 Code to that will be hell) and switch to C which is portable across systems (remember to abstract out the system depandant stuff to allow quicker and easier porting).

 Have fun :-D

Offline xeron

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 2533
    • Show only replies by xeron
    • http://www.petergordon.org.uk
Re: PowerPC asm programming
« Reply #13 on: February 26, 2003, 12:53:43 PM »
Quote

AmigaOS has a dedicated graphics subsystem called, strangly enough, the graphics.library which as a programmer you probably won't need very much. It is more common now to use the GUI system known as the intuition.library. This provides the programmer full graphics functions but keeps them in the context of the GUI, which users and graphics cards like!


Thats not quite true. Intuition.library provides commands for setting up displays and windows, and graphics.library provides the routines for rendering graphics into them. Intuition doesn't, for example, provide text, line drawing, area filling, or other graphics functions. As a programmer, you'll probably use both a lot, unless you go via toolkit such as ReAction or MUI. Even then, if you write custom classes, you'll probably use graphics.library to render them.

In fact, intuition calls graphics.library functions to render its own graphics.

Quote

I would also suggest you forget about PPC asm (porting x86 Code to that will be hell) and switch to C which is portable across systems (remember to abstract out the system depandant stuff to allow quicker and easier porting).


To an extent I agree; however I really enjoy assembler programming, and if this guy does too, well, theres nothing wrong with that.
Playstation Network ID: xeron6
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: PowerPC asm programming
« Reply #14 on: February 26, 2003, 01:27:29 PM »
as I said, he probably wouldn't need the Graphics.library very much. I didn't mean to make it sould like I was excluding it altogether!!!  :-D

I just prefered to used the inutition library for as much as possible as that allowed me to support graphics cards without modification. And the guy did say he wanted to program the PPC, so I'm guessing he isn't going to be using AmigaOS on an Amiga Classic (yes, yes, yes, I have a BlizzPPC... :-P )

I loved ASM coding... on the 68k... but the PPC is really quite boring (loved all those regs though!!!!). I've done very little x86 coding though.
I'm no fan of C... but it is probably the best language available (C/C++ ...Blah...)

P.S. I'm sure there's an intuition function for line drawing and filled polys...etc...!!! But it has been 5 years, I may have forgoten a few things...