Page 1 of 1

using assembly?

Posted: Sat Jul 21, 2012 5:09 am
by codycox.c
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.

Re: using assembly?

Posted: Sun Jul 22, 2012 11:43 am
by ziple
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.

Re: using assembly?

Posted: Mon Jul 23, 2012 2:35 am
by codycox.c
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

Re: using assembly?

Posted: Tue Jul 31, 2012 5:17 am
by codycox.c
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?

Re: using assembly?

Posted: Tue Jul 31, 2012 1:59 pm
by elhobbs
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.