using assembly?

support for the PSP toolchain
Post Reply
codycox.c
Posts: 49
Joined: Thu Mar 08, 2012 2:26 am

using assembly?

Post by codycox.c » Sat Jul 21, 2012 5:09 am

Is it possible to use assembly with C to make psp games? I was thinking that only using C might be too slow for some games.

ziple
Posts: 8
Joined: Fri May 22, 2009 7:17 am

Re: using assembly?

Post by ziple » Sun Jul 22, 2012 11:43 am

The rule is to first conceive, then improve the algorithms, and then, if needed, do some assembly.
But really, do you think you need ASM?
With GCC you can use some "inline assembly" in your C code. You can find pieces of information on google. But the psp cpu uses MIPS instructions, so the examples on the Internet which are mostly for x86 assembly will be useless.

codycox.c
Posts: 49
Joined: Thu Mar 08, 2012 2:26 am

Re: using assembly?

Post by codycox.c » Mon Jul 23, 2012 2:35 am

Is my makefile correctly written to compile the assembly code?

Code: Select all

TARGET = mebasic
OBJS = assembly.o main.o

INCDIR = 
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = ME Basic Example

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
and also is my assembly code correctly written?

Code: Select all

.global foo
.text
foo:
  lb $t1,$12

codycox.c
Posts: 49
Joined: Thu Mar 08, 2012 2:26 am

Re: using assembly?

Post by codycox.c » Tue Jul 31, 2012 5:17 am

How would I combine assembly and c? Is it like the gba where you have to create a s and a c file? Or is it done differently?

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: using assembly?

Post by elhobbs » Tue Jul 31, 2012 1:59 pm

the c/c++ compiler does a pretty good code making fast code. using assembly does not guarantee that it will be faster - you need to know what you are doing. make what you want to make, then figure out (by analysis - not guessing) where you need to improve speed. assembly is just one tool you can use to optimize performance. if you are just starting with assembly then you probably will have a hard time beating the compiler.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests