Is it worth it to make programs in full assembly ?

General Programming help in C, C++ or ASM, Compiling / Debugging, and R3000A Central Processing Unit (CPU) information
Post Reply
User avatar
New Nova
Active PSXDEV User
Active PSXDEV User
Posts: 48
Joined: Oct 27, 2018
I am a: Obscure dev, Artist
Motto: Try and retry.
PlayStation Model: SCPH-1002
Location: France
Contact:

Is it worth it to make programs in full assembly ?

Post by New Nova » November 2nd, 2021, 11:43 pm

Sorry if the question is already asked, but I want to know if it is worth it (or have some kind of benefits) to make programs and games 100% in MIPS assembly, and how to do it.

Thanks for taking the time of reading a stupid question lol :)
Development PC : AMD 1,150GHz CPU, 1GB RAM, Windows 98 SE
Development Unit : SCPH-1002 with Xplorer FX flashed with caetla037 firmware, CD unit replaced with PSOne's unit, MM3 modchip (stealth), Sync-On-Luma homemade cable, bicolor LED mod (blue for power, red when CD activity)
MY HOLY PONG IS NOT READY

Xavi92
Verified
C Programming Expert
C Programming Expert
Posts: 149
Joined: Oct 06, 2012

Post by Xavi92 » November 4th, 2021, 6:24 pm

I feel it is kind of subjective. While it is true hand-written MIPS assembly might lead to more optimized code (size and/or memory-wise) compared to a C compiler in specific situations, IMHO usually it is not worth the extra effort nowadays, or at least for application-level code. Modern optimizing compilers provide a good balance between convenience and resource usage. Also, I think one of the main benefits of working with a high-level language is, above all, portability. What if your game becomes surprisingly popular so the community want to port it to other platforms e.g.: x86_64, arm64 or even other cool retro consoles? They will have a really hard time if the game is written in pure MIPS I assembly. :)

OTOH, the PS1 is a very nice little beast! 2 MiB RAM are not that easy to fill up unless you do something wrong, so tons of high-level, not-so-optimized code can be written before memory becomes an issue. CPU-wise though, even if also powerful to handle complex logic, you need to choose your algorithms wisely and avoid unneeded operations so your game keeps running at those fantastic 50/60 fps (depending on PAL/NTSC).

However, I think hand-written assembly has its legitimate uses, like system libraries. For example, psn00bsdk is written in pure MIPS assembly so users can benefit from maximum speed and minimal memory footprint. For psn00bsdk, portability is not a concern at all, since it only targets the PS1 by design. While a C equivalent would have already been fine (e.g.: PSXSDK), psn00bsdk aims for that extra bit of performance that some users might be looking for.

In any case though, always profile your code, look for bottlenecks and apply the most appropriate solution you can come up with. Over-optimizing from the start is usually considered more of a red flag than a good practice.

User avatar
New Nova
Active PSXDEV User
Active PSXDEV User
Posts: 48
Joined: Oct 27, 2018
I am a: Obscure dev, Artist
Motto: Try and retry.
PlayStation Model: SCPH-1002
Location: France
Contact:

Post by New Nova » November 4th, 2021, 11:29 pm

Interesting !
Well, I think, for ps1 only, that it can be worth it to try making a simple program in full MIPS assembly, something that already exists.
Of course, since we can handle C on PS1, why ignore it ? That is way easier than assembly.
It's just that I thought about snes/genesis games made in pure assembly being the norm at the time, what would it take to do it on PS1, that is the generation after ?
I know MIPS assembly, I did it in school, but truly apply it for the experience on real hardware is interesting.

But you're right, trying from the start to over-optimize code is kind of bad.
I was more asking in a learning architecture way than just optimize stuff. I know that if I need REALLY optimized code, I can put assembly in my C code. I think that is a way clever way to think in optimization. :)
Development PC : AMD 1,150GHz CPU, 1GB RAM, Windows 98 SE
Development Unit : SCPH-1002 with Xplorer FX flashed with caetla037 firmware, CD unit replaced with PSOne's unit, MM3 modchip (stealth), Sync-On-Luma homemade cable, bicolor LED mod (blue for power, red when CD activity)
MY HOLY PONG IS NOT READY

User avatar
Shadow
Verified
Admin / PSXDEV
Admin / PSXDEV
Posts: 2558
Joined: Dec 31, 2012
PlayStation Model: H2000/5502
Discord: Shadow^PSXDEV

Post by Shadow » February 8th, 2022, 4:29 am

The main program is written in C and then the more computational functions are usually written in assembler. For example, Spyro was written in C but then the 3D engine was done in assembly which gave a drastic speed boost over the default Psy-Q SDK library functions.
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest