Zig-PSP

所属分类:编程语言基础
开发工具:Zig
文件大小:0KB
下载次数:0
上传日期:2022-09-15 14:47:04
上 传 者sh-1993
说明:  一个将Zig编程语言引入索尼PlayStation Portable的项目!,
(A project to bring the Zig Programming Language to the Sony PlayStation Portable!,)

文件列表:
LICENSE (3931, 2022-09-09)
OpenCommunityLetter.MD (5681, 2022-09-09)
ZigPSP_logo.png (100214, 2022-09-09)
build-psp.zig (3793, 2022-09-09)
build.zig (281, 2022-09-09)
examples/ (0, 2022-09-09)
examples/allocator.zig (1028, 2022-09-09)
examples/clearScreen.zig (1910, 2022-09-09)
examples/cube.zig (6669, 2022-09-09)
examples/error.zig (414, 2022-09-09)
examples/hello-min.zig (695, 2022-09-09)
examples/hello.zig (554, 2022-09-09)
examples/panic.zig (423, 2022-09-09)
examples/print.zig (510, 2022-09-09)
src/ (0, 2022-09-09)
src/logo.raw (8192, 2022-09-09)
src/main.zig (6669, 2022-09-09)
src/psp/ (0, 2022-09-09)
src/psp/include/ (0, 2022-09-09)
src/psp/include/pspatrac3.zig (105, 2022-09-09)
src/psp/include/pspaudio.zig (103, 2022-09-09)
src/psp/include/pspaudiocodec.zig (113, 2022-09-09)
src/psp/include/pspctrl.zig (101, 2022-09-09)
src/psp/include/pspdisplay.zig (107, 2022-09-09)
src/psp/include/pspdmac.zig (101, 2022-09-09)
src/psp/include/pspge.zig (97, 2022-09-09)
src/psp/include/pspgu.zig (100, 2022-09-09)
src/psp/include/pspgum.zig (102, 2022-09-09)
src/psp/include/psphprm.zig (101, 2022-09-09)
src/psp/include/psphttp.zig (101, 2022-09-09)
src/psp/include/pspiofilemgr.zig (111, 2022-09-09)
src/psp/include/pspjpeg.zig (101, 2022-09-09)
src/psp/include/pspkerror.zig (52, 2022-09-09)
src/psp/include/psploadexec.zig (109, 2022-09-09)
src/psp/include/pspmodulemgr.zig (111, 2022-09-09)
src/psp/include/pspmp3.zig (99, 2022-09-09)
... ...

Zig-PSP

A project to bring Zig to the Sony PlayStation Portable

## Why Zig on the PSP? In the PSP programming community, many libraries, tools, and other features are written in C or C++, which as we know has its problems with writing clean, reusable, and high quality code. Given that the core objectives of Zig as a language are to allow us to create well-designed and reusable software, Zig seems like a perfect fit for integrating older PSP libraries while striving to develop higher quality software! ## Special Thanks Special thanks is given to the [Rust-PSP team](https://github.com/overdrivenpotato/rust-psp) whose efforts influenced and helped to get this project off the ground. No harm is intended, and it's thanks to you Rustaceans that fellow Ziguanas can program for the PSP. ## Usage Currently, using Zig-PSP is rather straight forward - one must use the psp folder in their project's src folder in order to have the PSP's function definitions, alongside with some custom utilities I have created. One also must include the tools/ folder to use the post-build tools. To build a PSP app, use the included `build.zig` script to generate a PSP executable! (EBOOT.PBP / app.prx) This script is well commented for explanation and documentation. For a main.zig file one should include something like: ```zig const psp = @import("psp/utils/psp.zig"); comptime { asm(psp.module_info("Zig PSP App", 0, 1, 0)); } pub fn main() !void { psp.utils.enableHBCB(); psp.debug.screenInit(); psp.debug.print("Hello from Zig!"); } ``` A quick call to `zig build` will build your program and should emit an EBOOT.PBP and app.prx in your root. These are the two PSP executable formats - .prx for debugging, and .PBP for running normally. One can run a .PBP file on their PSP (assuming CFW is installed) by adding their application to `PSP_DRIVE:/PSP/GAME/YourAppName/EBOOT.PBP` and it will be available under the Games->Memory Stick list in the PSP's XMB. ## EBOOT Customization In order to customize the EBOOT, one can look into the `build.zig` file and modify the constant fields to change their application icon, background, and even add animations or sounds to the EBOOT on the XMB screen. ## Comparisons To C/C++ When comparing Zig code to C/C++, it would be rather apparent that by default, Zig is much smaller and tightly knit. LLVM is an excellent backend which produces some very small code, and Zig is an example of that. Without the weight of the entire C standard library needing to be imported, a simple naive Hello World, as seen above, generates in 10,195 bytes, compared to the C/C++ size of 68,098 bytes. That's an 85% reduction in size! With a few structural changes, as seen in `hello-min.zig` sample, that size can get down to 6,674 bytes! That's 90.2% smaller! Hopefully in the future, one could reference track the functions used in the SDK for imports, and dynamically generate module import information. This way, the PSP applications could go as small as 3,200 bytes for a hello world! This repository is distributed as part of a template, allowing one to customize their module imports, meaning that full release applications built with small tweaks to the toolchain NIDS directory could result in extraordinarily small executables for release applications! ## Documentation Currently Zig-PSP does not include documentation of the PSPSDK in the SDK's .zig files - but rather they are [well documented in C](http://psp.jim.sh/pspsdk-doc/). It is planned to add documentation in the future to resolve this ## Debugging If one has an installed copy of the legacy PSPSDK, one can use PSPLink - a USB debugging software, to connect their PSP to their computer and run debugging functions on the application. With legacy PSPSDK, you'll also have access to psp-gdb, a PSP-specific version of GDB to use as well. PSP-GDB with Zig is untested at the moment, but in theory should work.

近期下载者

相关文件


收藏者