24-bit color mode example

Programming examples for the Psy-Q SDK
Post Reply
User avatar
Psy-Q Enthusiast
Psy-Q Enthusiast
Posts: 388
Joined: Apr 10, 2013
I am a: Hobbyist Game Developer
Motto: Commercial or not, play it!
PlayStation Model: H2000/7000
Location: Philippines

24-bit color mode example

Post by LameGuy64 » June 3rd, 2013, 6:26 pm

PlayStation 1 24-bit color mode example

Username: LameGuy64
Project Title: 24-bit color mode example
Time to Complete: 3 days
Genre: Example
Latest Release: Version 1.0
In Development: No
Initial Release Date: 03-JUN-2013
Last Date Updated: 03-JUN-2013
Controller: Standard
Players: 1
Memory Card: N/A
Languages: English
Region: NTSC
Burn and Play: Yes
Executable Included: No
Source Included: Yes

This is a little program that demonstrates the use of the 640x480 24-bit color video mode on the PlayStation by loading 640x480 24-bit bitmap images. It also features a file buffer system I've made to make reading files from the CD a lot easier to do as you don't have to read the data in multiples of 2048 bytes.

I should note that the bitmap loader is very slow on a real PSX as it has to convert the color components in the bitmap file from BGR to RGB component order and has to load it row by row since bitmap files are saved with the image data upside down. Also, it only supports 640x480 24-bit bitmaps without color space information so its not very useful for almost anything other than this demo. If you want to load lossless 24-bit images quickly, you can use a 24-bit raw image dump which you load the file entirely into main memory and transfer its contents into the framebuffer but I'll cover that in a later date.

NOTE: The bitmap images I've included in this example are drawn by myself.

- LameGuy64


CUE + BIN and Source Code:
You do not have the required permissions to view the files attached to this post.
Please don't forget to include my name if you share my work around. Credit where it is due.

Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.

DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.

User avatar
C Programming Expert
C Programming Expert
Posts: 140
Joined: Dec 19, 2012
Motto: /\OX[]
PlayStation Model: SCPH-5502
Location: Australia

Post by t0rxe » June 3rd, 2013, 6:36 pm

Excellent! :clap

Just a small tip though. You don't need in your makefile:

Code: Select all

   ccpsx -O -Xo$80010000 main.c \psx\lib\none2.obj -oarot.cpe
You just need:

Code: Select all

# -----------------------------------------
#       PlayStation 1 Psy-Q Makefile
# Sony Computer Entertainment Europe (SCEE)
# -----------------------------------------

	del mem.map
	del main.sym
	del main.exe
	del main.cpe

	ccpsx -O3 -Xo$80010000 main.c -omain.cpe,main.sym,mem.map
	#ccpsx -O3 -Xo$80010000 main.c psyq/lib/none2.obj

	cpe2x /CE main.cpe
Also, you should clear the VRAM before loading in another image: viewtopic.php?f=51&t=316

On another note, I was going to look into using the libpress library for .BR files made by converting tims in MC32.
It would make loading quick and offer storage benefits because it is under compression.
How to make the .BR file correctly is what I'm currently stuck on, so I'm reading the Sony documents.
"Nostalgia isn't a big enough word to describe the PlayStation from my eyes"

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest