參考資訊:
https://psx.arthus.net/starting.html
https://github.com/ABelliqueux/nolibgs_hello_worlds#installation
main.c
#include <sys/types.h> #include <stdio.h> #include <libgte.h> #include <libetc.h> #include <libgpu.h> int main(int argc, char *argv[]) { const int w = 320; const int h = 240; DISPENV disp = { 0 }; DRAWENV draw = { 0 }; ResetGraph(0); SetDefDispEnv(&disp, 0, 0, w, h); SetDefDrawEnv(&draw, 0, 0, w, h); SetDispMask(1); setRGB0(&draw, 0, 0, 0); draw.isbg = 1; PutDispEnv(&disp); PutDrawEnv(&draw); FntLoad(640, 0); FntOpen(100, 100, w, h, 0, 255); while (1) { FntPrint("Hello, world!"); FntFlush(-1); DrawSync(0); VSync(0); PutDispEnv(&disp); PutDrawEnv(&draw); } return 0; }
system.cnf
BOOT=cdrom:\main.exe;1 TCB=4 EVENT=10 STACK=801FFFF0
cdrom.xml
<?xml version="1.0" encoding="UTF-8"?> <iso_project image_name="cdrom.bin" cue_sheet="cdrom.cue"> <track type="data"> <identifiers system="playstation" application="playstation" volume="main" volume_set="main" publisher="main" data_preparer="mkpsxiso" /> <directory_tree> <file name="system.cnf" type="data" source="system.cnf"/> <file name="main.exe" type="data" source="main.exe"/> </directory_tree> </track> </iso_project>
編譯、執行
$ make $ mkpsxiso -y cdrom.xml $ /opt/ps1/pcsx -cdfile cdrom.bin