Cd functions when using exe

Miscellaneous and un-categorized content regarding the PlayStation 1
Post Reply
User avatar
Tylerpsx
Curious PSXDEV User
Curious PSXDEV User
Posts: 10
Joined: Oct 28, 2022
I am a: Programmer
Motto: You can do it if you know how
PlayStation Model: 5501
Location: United States

Cd functions when using exe

Post by Tylerpsx » November 18th, 2022, 1:53 pm

When I use exe for debug on my psx emulator when running cd type function
In the development librarys will the exe be able to get the library’s like if it was using the cd but virtually or will I have to use a program to turn the files or modify the files to be read by the exe and if so can someone point me in the right direction

User avatar
Administrator
Verified
Admin / PSXDEV
Admin / PSXDEV
Posts: 2689
Joined: Dec 31, 2012
I am a: Shadow
PlayStation Model: H2000/5502

Post by Administrator » November 18th, 2022, 4:15 pm

If you're using an emulator, you can read the files from the CD (be it via malloc or a hard coded memory location). Otherwise, you will need to include them as raw binary data in the EXE itself which wastes a lot of BSS room. If you're making a game, I'd recommend using some malloc routines when using the CD so you can load data into the heap, use it as needed and then free that heap space for other stuff later.
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.

Xavi92
Verified
C Programming Expert
C Programming Expert
Posts: 161
Joined: Oct 06, 2012
PlayStation Model: SCPH-5502
Contact:

Post by Xavi92 » December 3rd, 2022, 9:57 am

Shadow wrote:I'd recommend using some malloc routines when using the CD so you can load data into the heap, use it as needed and then free that heap space for other stuff later.
If using fread(3) to read CD-ROM data, a more space-efficient (although possibly a bit slower) alternative is buffered I/O. This means the underlying libc implementation stores a sector-sized (i.e., 2048 byte) cache in order to allow applications to read from memory (which is faster than CD-ROM access) as long as it resides within the same sector. I keep a forked copy of PSXSDK where I have implemented this.

If using buffered I/O, applications do not need to allocate a large amount of memory to read a complete file, but only the exact amount of bytes that are needed, and let the libc implementation do the rest. This is an example from a video game I am working on, where small amounts of memory are allocated on the stack to read a TIM file from CD-ROM to GPU.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests