melonDS-emu / melonDS

DS emulator, sorta
https://melonds.kuribo64.net
GNU General Public License v3.0
2.99k stars 497 forks source link

Add interrupt instruction for games to print to terminal #1947

Open abaresk opened 5 months ago

abaresk commented 5 months ago

If the game executes svc 0xFC, the contents of the null-terminated string addressed in register r0 will be printed to the terminal.

For consistency, this is the same mechanism that is used in Desmume (source).

windwakr commented 5 months ago

Is there actually any homebrew out there that uses this over nocash prints?

abaresk commented 5 months ago

This is more helpful for rom-hacking and decompilation, where you'd have the ability to insert arbitrary print statements.

Additionally, as far as I'm aware, Desmume does not support the nocash debug registers. It would be nice to have a printing mechanism that works across both emulators.

abaresk commented 5 months ago

Just following up, are there any concerns with merging in this feature?

abaresk commented 4 months ago

Sorry to keep bugging, is it okay to merge this?

Gericom commented 4 weeks ago

I would suggest that if this feature will be added it should be an opt-in feature to avoid clashing with possible other uses of this swi. E.g. someone can map vectors to itcm and have their own swi handler. It's rare, but possible (for example in gbarunner3). Personally I think the existing way to print with no$ IO registers is less intrusive in that regard.