Ravenslofty / prussia

Prussia - a Rust PS2 SDK.
Other
110 stars 6 forks source link

prussia_bios: Wrapping BIOS calls #2

Open Ravenslofty opened 5 years ago

Ravenslofty commented 5 years ago

Some open questions:

Ravenslofty commented 5 years ago

Syscalls by number (as documented in PS2tek):

zachary-cauchi commented 8 months ago

Hello @Ravenslofty. I'm very new to the PS2 dev scene so my opinion may not carry much weight.

I don't imagine all the syscalls are needed, and some are higher-priority than others. Eventually, most would be desired, but some would be desired sooner than others, so how about a roadmap to plot which syscalls are needed for which desired features (for instance, strings I imagine would require the heap-related syscalls)?

Regarding Rust vs assembly, I don't know how much of a bloat the rust implementation would take. For the time being, I'd say leave it in Rust where the environment is familiar, and then if need be, upgrade it to assembly. For the time being, if file size really is an issue, feature flags may help with stripping away unused functions.

What do you think?

Ravenslofty commented 8 months ago

Hello @Ravenslofty. I'm very new to the PS2 dev scene so my opinion may not carry much weight.

I don't imagine all the syscalls are needed, and some are higher-priority than others. Eventually, most would be desired, but some would be desired sooner than others, so how about a roadmap to plot which syscalls are needed for which desired features (for instance, strings I imagine would require the heap-related syscalls)?

Well, yes and no. See, the PS2 was built around a...modest threading library, and so the heap syscalls interface with that (they set up per-thread heaps). But I think in modern times we would use async/await which maps a bit nicer to the PS2.

Regarding Rust vs assembly, I don't know how much of a bloat the rust implementation would take. For the time being, I'd say leave it in Rust where the environment is familiar, and then if need be, upgrade it to assembly. For the time being, if file size really is an issue, feature flags may help with stripping away unused functions.

What do you think?

There's certainly some mitigation to the bloat of implementing things in Rust: by not depending on any of the PS2 BIOS calls we can treat the space used by the BIOS as free memory and reclaim a megabyte or so of memory.

zachary-cauchi commented 8 months ago

True that about the threading, if memory serves its only a single core cpu (not counting VUs and other bits)?

In that case, I suppose there isn't need for any of the bios calls is there? What would you suggest as a next step?

Ravenslofty commented 8 months ago

I would say there is exactly one useful BIOS call from Prussia's point of view: SetGsCrt, which configures the GS for the relevant video mode.

This can be RIIR'd, but I think it would be easier to do if we had the GS video registers abstracted over, which brings us back to #9...