debug a crash by setting a breakpoint on cd-rom read

General Programming help in C, C++ or ASM, Compiling / Debugging, and R3000A Central Processing Unit (CPU) information
Post Reply
What is PSXDEV?
What is PSXDEV?
Posts: 2
Joined: September 5th, 2017, 1:05 am

debug a crash by setting a breakpoint on cd-rom read

Post by Infrid » September 5th, 2017, 6:07 pm


I am working on a fan translation for the game ace combat 3 and I would explain few issues and find the best solution with your help.

The game stores the text as images in TIM files and it's pretty easy to edit them, but those images are stored in a big container. The files involved are ACE.BPB for storing the actual files, aligned to the sector, and ACE.BPH for the information about the positions in the disk.

We have a tool that reads those 2 files and unpack the content, many files are compressed in a custom ulz format and I manage to work on those files. There is also a tool for pack and rebuild the BPB and BPH.

The TIMs are compressed in lz77 and I wrote a compressor/decompressor for that, the algorithm is working for me, at least the decompressor. I can see all the game content.

I would translate the game menu, there is a file for that compressed in ulz at some offset of ACE.BPB, with psxfin (maybe I should use no$psx) I set a breakpoint for write into the RAM at a specific address and I can see the decompressor algorithm working.

I edited the menu file, I compress it and build the BPB and BPH. The game crashes reading my changed file and I don't understand why, clearly it could be a problem of my compressor but I can't see the decompressor algorithm with the same breakpoint.

I looked inside the executable with a disassembler in order to find the uncompress routine but I cannot see the part where the game reads the ulz's header. I suspect I made a mistake there, in fact if I don't compress the file, the game reads it anyway (at cost of loading speed).

I read the docs on how the console is supposed to control the cd-rom, it stores some values in a memory address and fires an interrupt for reading a sector but I have few problems.

- Get the exact sector where my file is stored
- Set a breakpoint with the emulator

For the first, I could change the unpacker and have an idea where the file is store, but it doesn't seems a nice way to do it, do you know a better technique?

For the breakpoint, is there an emulator where I can set a breakpoint to a sector regardless the way how the psx read it? It could use few API calls and I would avoid to set a breakpoint to a DMA, I could need to investigate for other files in the feature and it would be nice to have a smoother workflow.


Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests