| View previous topic :: View next topic |
| Author |
Message |
Recursive Acronym
Joined: 01 Jan 2008 Posts: 5
|
Posted: Tue Jan 01, 2008 4:26 am Post subject: Assembly Language |
|
|
Can anyone point me to a web page that will teach me how to program the PSP in pure assembly language? I already know Zilog Z80 assembly, and I have a Mac with OS 10.4 to program the PSP from, but I have a Windows computer at my dad's house that I can use if necessary. I have found this, but is there a site specifically about PSP assembly?
Last edited by Recursive Acronym on Tue Jan 01, 2008 9:55 am; edited 2 times in total |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Tue Jan 01, 2008 7:03 am Post subject: |
|
|
| No. Programming the PSP in assembly is the same as programming it in C, but using assembly instead of C. If you don't understand that, you aren't ready to program in assembly. |
|
| Back to top |
|
 |
snow
Joined: 15 Dec 2007 Posts: 31
|
|
| Back to top |
|
 |
Recursive Acronym
Joined: 01 Jan 2008 Posts: 5
|
Posted: Tue Jan 01, 2008 9:50 am Post subject: |
|
|
@snow:
Thanks.
@J.F.:
What are you saying? I don't understand. |
|
| Back to top |
|
 |
Recursive Acronym
Joined: 01 Jan 2008 Posts: 5
|
Posted: Tue Jan 01, 2008 9:53 am Post subject: Re: Assembly Language |
|
|
| _______ |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Tue Jan 01, 2008 12:44 pm Post subject: |
|
|
What JF is saying is that learning assembly is learning assembly, no matter the platform. Learning PSP programming is a separate task. You almost certainly won't find a tutorial that teaches you both in one step.
Jim _________________ http://www.dbfinteractive.com |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Wed Jan 02, 2008 2:38 am Post subject: |
|
|
| Jim wrote: | What JF is saying is that learning assembly is learning assembly, no matter the platform. Learning PSP programming is a separate task. You almost certainly won't find a tutorial that teaches you both in one step.
Jim |
Yes, very nicely put and exactly the point I was trying to make. Thanks!
Learn MIPS assembly, then learn programming the PSP, THEN put the two together. You'll have answered your own original request.
Oh, I do have one suggestion for after you learn MIPS assembly - edit the pspsdk sample makefile to add -S to the CFLAGS to have it stop after generating the assembly intermediate files. You can then look at how the sdk is called from assembly. One interesting thing I learned from that is that args are passed in a0-a3, then t0-t3, then on the stack. Most MIPS ABIs don't use the temps for passing args. |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Wed Jan 02, 2008 4:38 am Post subject: |
|
|
| J.F. wrote: | | Jim wrote: | What JF is saying is that learning assembly is learning assembly, no matter the platform. Learning PSP programming is a separate task. You almost certainly won't find a tutorial that teaches you both in one step.
Jim |
Yes, very nicely put and exactly the point I was trying to make. Thanks!
Learn MIPS assembly, then learn programming the PSP, THEN put the two together. You'll have answered your own original request.
Oh, I do have one suggestion for after you learn MIPS assembly - edit the pspsdk sample makefile to add -S to the CFLAGS to have it stop after generating the assembly intermediate files. You can then look at how the sdk is called from assembly. One interesting thing I learned from that is that args are passed in a0-a3, then t0-t3, then on the stack. Most MIPS ABIs don't use the temps for passing args. |
this is because t0-t3 (old ABI) may be also called a4-a7 (EABI32) but the unofficial gcc and bintools for psp are old and tend to use the old register naming whereas firmware and sony applications or games are probably using EABI.
Nothing really weird indeed.
Last edited by hlide on Wed Jan 02, 2008 7:06 am; edited 1 time in total |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Wed Jan 02, 2008 4:46 am Post subject: |
|
|
| The unofficial gcc/binutils are not old at all and standard binutils as doesn't support mnemonic register names anyway (except a few special ones), I added support for that with names which more closely reflect the fact that tX is more often used as a temp value than it is used as an argument. |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Wed Jan 02, 2008 7:05 am Post subject: |
|
|
| TyRaNiD wrote: | | The unofficial gcc/binutils are not old at all and standard binutils as doesn't support mnemonic register names anyway (except a few special ones), I added support for that with names which more closely reflect the fact that tX is more often used as a temp value than it is used as an argument. |
a0-a3 can be used as temporary registers as well, but they are still named as aX and not tX. In fact, the only issue is that people tend to think tX as NOT being an argument register and that's all. If i'm not wrong, the unofficial psp-gcc also uses eabi which explains why we can have functions with over 4 argument registers : that's the only important point here.
By old, i mean this gcc doesn't reflect what the last official gcc can do : i was told it can handle VFPU intrinsics for instance. That's all. Official binutils probably uses r0-r31 or $0-$31 as register naming, which is another way to make the naming problem irrelevant.
Last edited by hlide on Wed Jan 02, 2008 7:42 am; edited 1 time in total |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Wed Jan 02, 2008 7:41 am Post subject: |
|
|
| Odd, the docs I've read on EABI for MIPS say the args go in a0-a3, then onto the stack. There is no mention of any a4-a7, or using t0-t3 for args. Oh well, not a big deal. I was aware that you could use unused arg regs as temporaries - that seems like a no-brainer to me. Arg regs are just temporaries that happen to have an initial value when the function is entered. I guess it would depend on how you learned assembly, and on what platform. If you initially learned on the x86, you might not have run into that idea as the x86 has very few registers, and the normal ABI has you passing all args on the stack. Funny enough, the SYSV ABI for the 68000 also passes args on the stack even though the 68000 has plenty of regs. Most 68000-based machines used the regs for passing args to the OS/BIOS. Both the Mac and Amiga were that way. |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Wed Jan 02, 2008 7:47 am Post subject: |
|
|
| J.F. wrote: | | Odd, the docs I've read on EABI for MIPS say the args go in a0-a3, then onto the stack. |
they don't mention explicitely aX/tX but use rX indeed :
"If GR > r11, go to STACK" (r11 = a7/t3)
http://sourceware.org/ml/binutils/2003-06/msg00436.html
NOTE : EABI is not alone, there are also :
- O32 ABI which uses mnemonic registers a0-a3, t0-t3
- N32 ABI which uses mnemonic registers a0-a7 |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Wed Jan 02, 2008 9:15 am Post subject: |
|
|
| hlide wrote: | | J.F. wrote: | | Odd, the docs I've read on EABI for MIPS say the args go in a0-a3, then onto the stack. |
they don't mention explicitely aX/tX but use rX indeed :
"If GR > r11, go to STACK" (r11 = a7/t3)
http://sourceware.org/ml/binutils/2003-06/msg00436.html
NOTE : EABI is not alone, there are also :
- O32 ABI which uses mnemonic registers a0-a3, t0-t3
- N32 ABI which uses mnemonic registers a0-a7 |
Very odd indeed. If you read the MIPS stuff, you find stuff like this: from the MIPS32 Instruction Set Quick Reference PDF...
| Quote: | Function Pararmeters
* Every parameter smaller than 32 bits is promoted to 32 bits.
* First four parameters are passed in registers $a0-$a3.
(a note about 64 bit passing I won't type out)
* Every subsequent parameter is passed on the stack.
* First 16 bytes on the stack are not used.
(etc) |
The main MIPS32 reference manual I have says the same thing. I guess the ABI MIPS itself came up with is different from the SYSV ABIs you quote from. |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Wed Jan 02, 2008 9:34 am Post subject: |
|
|
| J.F. wrote: | | The main MIPS32 reference manual I have says the same thing. I guess the ABI MIPS itself came up with is different from the SYSV ABIs you quote from. |
Anyway, when i made some modifications in MIPS gcc source (trying to add vfpu handling), i happen to find out psp-gcc was using EABI - and in the code, it is 8 general purpose argument registers exactly as specified in my last link. There are also O32 (the one you probably specified with only 4 general purpose argument registers) and N32 (which uses also 8 general purpose argument registers), but psp-gcc doesn't use them. |
|
| Back to top |
|
 |
Recursive Acronym
Joined: 01 Jan 2008 Posts: 5
|
Posted: Thu Jan 03, 2008 12:44 am Post subject: |
|
|
| Thanks. I program graphing calculators, and for calculators there's a single document that explains almost everything. |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Thu Jan 03, 2008 10:50 am Post subject: |
|
|
Same with a microprocessor, then there can be an all encompassing document or datasheet.
I never see any assembler samples around.
It would be nice to use some asm samples within C,
but all the RISC stuff I did is not MIPS anyway. _________________ If not actually, then potentially. |
|
| Back to top |
|
 |
|