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
Is it worth it to make programs in full assembly ?
- New Nova
- Active PSXDEV User
- Posts: 61
- Joined: Oct 27, 2018
- I am a: Collector, developper, artist
- Motto: RTFM
- PlayStation Model: DTL-H2000
- Location: France
- Contact:
Is it worth it to make programs in full assembly ?
Development PC : Compaq PC, Intel Pentium III 600MHz, 256MB RAM, NVIDIA GeForce4 MX 440 (AGP)
Development Unit : DTL-H2000 board + DTL-H2010 CD-ROM drive
Retail Unit : SCPH-1002 + XplorerFX + caetla + modchip + activity LED mod
Development Unit : DTL-H2000 board + DTL-H2010 CD-ROM drive
Retail Unit : SCPH-1002 + XplorerFX + caetla + modchip + activity LED mod
-
Verified
- C Programming Expert
- Posts: 161
- Joined: Oct 06, 2012
- PlayStation Model: SCPH-5502
- Contact:
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.
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.
- New Nova
- Active PSXDEV User
- Posts: 61
- Joined: Oct 27, 2018
- I am a: Collector, developper, artist
- Motto: RTFM
- PlayStation Model: DTL-H2000
- Location: France
- Contact:
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.
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 : Compaq PC, Intel Pentium III 600MHz, 256MB RAM, NVIDIA GeForce4 MX 440 (AGP)
Development Unit : DTL-H2000 board + DTL-H2010 CD-ROM drive
Retail Unit : SCPH-1002 + XplorerFX + caetla + modchip + activity LED mod
Development Unit : DTL-H2000 board + DTL-H2010 CD-ROM drive
Retail Unit : SCPH-1002 + XplorerFX + caetla + modchip + activity LED mod
-
Shadow Verified
- Admin / PSXDEV
- Posts: 2670
- Joined: Dec 31, 2012
- PlayStation Model: H2000/5502
- Discord: Shadow^PSXDEV
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.
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.
Who is online
Users browsing this forum: No registered users and 3 guests