| View previous topic :: View next topic |
| Author |
Message |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Wed Oct 18, 2006 10:33 pm Post subject: How to I assemble... |
|
|
How do I assemble a raw .asm file into an eboot? What's would be a good makefile for my code?
Here's my code:
(add.s)
| Code: | ## Program to add two plus three
.text
.globl main
main:
ori $8,$0,0x2 # put two's comp. two into register 8
ori $9,$0,0x3 # put two's comp. three into register 9
addu $10,$8,$9 # add register 8 and 9, put result in 10
## End of file |
BTW: I don't wanna use any c in this. I want it to be complete asm.
Last edited by Zettablade on Fri Oct 20, 2006 7:23 am; edited 1 time in total |
|
| Back to top |
|
 |
0okm0000

Joined: 13 Jan 2006 Posts: 116
|
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Thu Oct 19, 2006 3:35 am Post subject: |
|
|
Yah minifire does go the whole hog, no C what so ever, if you use main at all then you are including C in the crt0 (which is the entry point) and newlib, not that that perhaps worries you :) If you are just interested in your code being asm then just put your code into a main.s file, then in the standard Makefile add main.o as an object and the build system worries about doing the rest.
Of course you _may_ want to add a jr $ra; nop; to that bit of asm else it is, not will crash in an unexpected way depending what code is after that bit of asm :P |
|
| Back to top |
|
 |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Thu Oct 19, 2006 4:16 am Post subject: |
|
|
| TyRaNiD wrote: | Yah minifire does go the whole hog, no C what so ever, if you use main at all then you are including C in the crt0 (which is the entry point) and newlib, not that that perhaps worries you :) If you are just interested in your code being asm then just put your code into a main.s file, then in the standard Makefile add main.o as an object and the build system worries about doing the rest.
Of course you _may_ want to add a jr $ra; nop; to that bit of asm else it is, not will crash in an unexpected way depending what code is after that bit of asm :P |
Well, I'm still learning asm, but thx anyways. I can't checkout mini fighter now, but I'll be sure to check it out once I get home. |
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Thu Oct 19, 2006 10:34 am Post subject: |
|
|
I said Tyranid will know how it works :) Well, thanks for the info, always good to learn something new _________________ <Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl |
|
| Back to top |
|
 |
Tinnus
Joined: 29 Jul 2006 Posts: 67
|
Posted: Thu Oct 19, 2006 11:38 pm Post subject: |
|
|
BTW, I don't think 0x89 is 3... _________________ Let's see what the PSP reserves... well, I'd say anything is better than Palm OS. |
|
| Back to top |
|
 |
Zettablade
Joined: 05 May 2006 Posts: 71
|
Posted: Fri Oct 20, 2006 11:59 am Post subject: |
|
|
| Tinnus wrote: | | BTW, I don't think 0x89 is 3... |
lol that was a typo of sorts.... |
|
| Back to top |
|
 |
jsharrad
Joined: 20 Oct 2005 Posts: 102
|
Posted: Wed Mar 26, 2008 2:40 pm Post subject: |
|
|
| TyRaNiD wrote: | Yah minifire does go the whole hog, no C what so ever, if you use main at all then you are including C in the crt0 (which is the entry point) and newlib, not that that perhaps worries you :) If you are just interested in your code being asm then just put your code into a main.s file, then in the standard Makefile add main.o as an object and the build system worries about doing the rest.
Of course you _may_ want to add a jr $ra; nop; to that bit of asm else it is, not will crash in an unexpected way depending what code is after that bit of asm :P |
I know I'm grave-digging a REALLY old post here, but Tyranid, is what you have in the minifire archive what your compiler actually gave you after compiling that source or did you edit the ELF files to compact them?
When I compile that source, I get this:
| Code: | Start of program headers: 52 (bytes into file)
Start of section headers: 4940 (bytes into file)
Flags: 0x10a23001, noreorder, unknown CPU, eabi32, mips2
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 1
Size of section headers: 40 (bytes)
Number of section headers: 8
Section header string table index: 7
|
Notice the offset of the section headers, almost 5k in the file (the majority of the file is filled with 00's before it actually gets to the program data)
Whereas yours is:
| Code: | Start of program headers: 60 (bytes into file)
Start of section headers: 52 (bytes into file)
Flags: 0x10a23001, noreorder, unknown CPU, eabi32, mips2
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 1
Size of section headers: 40 (bytes)
Number of section headers: 3
Section header string table index: 2
|
With a total filesize of 671 bytes.
Is there something I'm missing to compile it like this? or did you edit the file contents and offsets manually? :) |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Wed Mar 26, 2008 4:35 pm Post subject: |
|
|
| I wrote a quick and dirty repacker which removed the segment alignment stuff down to something more sensible :P |
|
| Back to top |
|
 |
jsharrad
Joined: 20 Oct 2005 Posts: 102
|
Posted: Thu Mar 27, 2008 7:38 pm Post subject: |
|
|
| TyRaNiD wrote: | | I wrote a quick and dirty repacker which removed the segment alignment stuff down to something more sensible :P |
That's what I thought ;)
Neat trick with the embedding one table inside another, would have never thought to do that myself. Gave me the idea of doing the same with some of the .data segment with the repacker I wrote. Managed to get the filesize down to 644 bytes and still have a working binary on the PSP :) |
|
| Back to top |
|
 |
|