Writing an assembler for the PS1

Confidential documents, images and information by Sony and miscellaneous hackers for the PlayStation 1
Post Reply
User avatar
MysticLord
Curious PSXDEV User
Curious PSXDEV User
Posts: 11
Joined: August 9th, 2017, 3:06 am

Writing an assembler for the PS1

Post by MysticLord » August 9th, 2017, 3:46 am

I'm writing an assembler and a disassembler for the PS1. I want them to be the end-all, be-all of PS1 (dis)assemblers.

Questions:

1. The specific instruction set used by the PS1 is MIPS r3000, correct?

2. Are there any additional operations that a PS1 assembler should support? Operations such as reading from a disc image, writing to a memory card, communicating with the GPU, or what what have you.

3. If there are, where can I find more info about them?

4. What open source assemblers and disassemblers exist for the PS1?

5. What advice do you have for me?

User avatar
CodeAsm
Active PSXDEV User
Active PSXDEV User
Posts: 64
Joined: January 13th, 2012, 12:41 am
I am a: Programmer, Student
IRC: codeasm
Steam: codeasm
Location: The Netherlands
Contact:

Re: Writing an assembler for the PS1

Post by CodeAsm » August 10th, 2017, 6:26 am

isnt the GNU toolset good enough? (also I think they contain any hits you might need. tho you might want to write macros for like "Operations such as reading from a disc image, writing to a memory card, communicating with the GPU, or what what have you." :P
further im just a noob, I only know I probably could write in assembler using the GNU tools for MIPS
Development Console: SCPH-102, unkown clone Modchip, PAL , FTDI board build into the case (microUSB) for Serial I/O.
Development Computer: GNU/Linux, Arch x86_64 Linux 4.20.3, i7-3632QM [8x3.2GHz], 11,8GiB, 1366x768 GeForce GT 630M (Optimus tech), lots of gig of storage

User avatar
Someone
Curious PSXDEV User
Curious PSXDEV User
Posts: 17
Joined: August 7th, 2016, 11:40 pm
I am a: ROM hacker hobbyist
Want to Find: Interesting info about PS1

Re: Writing an assembler for the PS1

Post by Someone » August 10th, 2017, 10:20 am

For all needed info check nocash's site, he did comprehensive PS1 research and documented it very well, he also made very advanced PS1 emulator with debugger, though it's not perfect. Also you can use IDApro for disassembling PS1 games if you need reference source for your own work, though I doubt that if you write your disassembler then it will be better than IDA's and yet maybe for someone it still be useful so I won't stop you from doing that ;). Also on romchaking.net you can find some assembly tools and check them if you want.

User avatar
MysticLord
Curious PSXDEV User
Curious PSXDEV User
Posts: 11
Joined: August 9th, 2017, 3:06 am

Re: Writing an assembler for the PS1

Post by MysticLord » August 11th, 2017, 2:45 am

http://problemkaputt.de/psx-spx.htm

I want to write a (dis)assembler that supports literally every opcode you would find in a PS1 game. This includes opcodes that deal with cd-rom seeks, reads, and writes, and anything else that you will find.

User avatar
Orion_
Legendary Programmer
Legendary Programmer
Posts: 228
Joined: August 13th, 2012, 2:48 am
I am a: Programmer
PlayStation Model: Net Yaroze
Location: France
Contact:

Re: Writing an assembler for the PS1

Post by Orion_ » August 11th, 2017, 6:49 am

well, maybe you should learn first what "assembler" is, because such opcodes doesn't exist.
assembler is related to the CPU of the machine, it has nothing to do with CD ROM which is another peripheral to which you talk through specific addresses.
Retro game development on Playstation and other consoles http://orionsoft.free.fr/

User avatar
MysticLord
Curious PSXDEV User
Curious PSXDEV User
Posts: 11
Joined: August 9th, 2017, 3:06 am

Re: Writing an assembler for the PS1

Post by MysticLord » August 11th, 2017, 9:29 am

So the functions cdrom setloc, read, and write referenced in this post are not actual opcodes but something else entirely?

https://www.romhacking.net/forum/index. ... #msg266131
How do you find these LBA tables? Well you need to run pSX with logging enabled and you need to log all CDROM IO. now just play the game as normal and save the log. Any time you see a line in the log such as

[015b009c] cdrom: setloc 00000000:00000002:00000005

it will be closely followed by lines such as these
[015b00a4] cdrom: read byte 07801800 = 09 (800584dc)
[015b00a4] cdrom: write byte 07801800 = 01 (800584ec)

Those address in the brackets
(800584dc)
(800584ec)
Are a part of the function "setloc". mark the entry point of that function in your disassembly.
Are these functions the result of a call to syscall? Where can I find a complete listing of mips opcodes (and their parameters) that the PS1 supports?

https://courses.missouristate.edu/KenVo ... lHelp.html
^An example of syscall parameters on the MARS mips emulator.

http://psx.rules.org/system.txt
^Seems to be what I'm looking for, if anyone wants to verify.

https://stackoverflow.com/questions/203 ... nstruction
^A guy verifies that syscall was used to execute math calculations on a vector processing unit.

User avatar
CodeAsm
Active PSXDEV User
Active PSXDEV User
Posts: 64
Joined: January 13th, 2012, 12:41 am
I am a: Programmer, Student
IRC: codeasm
Steam: codeasm
Location: The Netherlands
Contact:

Re: Writing an assembler for the PS1

Post by CodeAsm » August 11th, 2017, 6:10 pm

I have no idea if this is any good: http://chortle.ccsu.edu/assemblytutorial/
I dont speak Mips assembly (yet) but @Orion_ seems to be right here, "what is an assembler" what does it do?
What is machine language... what do those bytes mean when you look at a executable? can you write those yourself?
And how do you call a function you created yourself from another part of your code?
can you call a "kernel" function? I think all those questions will be answered if I study assembly and use a assmbler before I would write my own assembler. (I want to, for a Z80, but have to understand the language of the cpu first, its default/common used tools first)

Or, you start with a few simple instructions and write an asembler for those first and hope the PS1 accepts your binairy. https://vhouten.home.xs4all.nl/mipsel/r3000-isa.html my head spins already ;)
Development Console: SCPH-102, unkown clone Modchip, PAL , FTDI board build into the case (microUSB) for Serial I/O.
Development Computer: GNU/Linux, Arch x86_64 Linux 4.20.3, i7-3632QM [8x3.2GHz], 11,8GiB, 1366x768 GeForce GT 630M (Optimus tech), lots of gig of storage

User avatar
Orion_
Legendary Programmer
Legendary Programmer
Posts: 228
Joined: August 13th, 2012, 2:48 am
I am a: Programmer
PlayStation Model: Net Yaroze
Location: France
Contact:

Re: Writing an assembler for the PS1

Post by Orion_ » August 11th, 2017, 10:09 pm

you should try to learn the assembler language and write some assembler code for the PS1 before writing an assembler yourself.
there are some asm source for PS1 on this page in the MISC section: http://hitmen.c02.at/html/psx_sources.html
Retro game development on Playstation and other consoles http://orionsoft.free.fr/

User avatar
MysticLord
Curious PSXDEV User
Curious PSXDEV User
Posts: 11
Joined: August 9th, 2017, 3:06 am

Re: Writing an assembler for the PS1

Post by MysticLord » August 12th, 2017, 7:28 am

I'm a programmer, the best way to learn MIPS is to write an assembler. It doesn't seem very hard. I need to know exactly what bits are set with each opcode and all their possible parameters, and what opcodes the PS1 supports.

Labels seem straight-forward.

For a disassembler, I want a way to make it read certain things as something other than assembly - maybe as a table of bytes. How I get it to do that is my problem.

My goal for the disassembler is to have something where once you know everything there is to know about a file, you can feed it everything you know and it will output something that you can assemble and get the exact same file back.

Depending on how I implement the opcode table I can see it being extensible.

Anyways, my questions are:

1. What opcodes doe the PS1 support?

2. What are the parameters for those opcodes not found in general purpose MIPS documents?

Probably the only people who could answer these questions are gemini and nocash.

User avatar
Orion_
Legendary Programmer
Legendary Programmer
Posts: 228
Joined: August 13th, 2012, 2:48 am
I am a: Programmer
PlayStation Model: Net Yaroze
Location: France
Contact:

Re: Writing an assembler for the PS1

Post by Orion_ » August 12th, 2017, 10:02 pm

Retro game development on Playstation and other consoles http://orionsoft.free.fr/

User avatar
brill
Curious PSXDEV User
Curious PSXDEV User
Posts: 22
Joined: April 30th, 2013, 12:57 pm
PlayStation Model: SCPH-7502
Skype: brillxxxx
Location: Ukraine, Odessa
Contact:

Re: Writing an assembler for the PS1

Post by brill » September 28th, 2017, 3:13 am

1 x SCPH-1002, 1 x SCPH-7502, 1 x SCPH-102
1 x Xplorer V2 with Caetla [v.0.37]

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest