Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the register-based nocashMessage #840

Open
lifehackerhansol opened this issue Oct 1, 2024 · 7 comments
Open

Support the register-based nocashMessage #840

lifehackerhansol opened this issue Oct 1, 2024 · 7 comments

Comments

@lifehackerhansol
Copy link
Contributor

State your operating system:

Windows 10

DesMuME version

git master (last tested commit 9119678)

Issue

No$GBA supports more than the opcode-based debugging (which is already supported); it also supports writing directly to some pseudo-register, either one char at a time, or a pointer to a string in memory to print at once.

GBATEK explains this concept briefly: https://problemkaputt.de/gbatek-ds-debug-registers-emulator-devkits.htm

You may see the below homebrew code to reproduce this functionality (compile with devkitARM):
https://gist.github.com/lifehackerhansol/71e714574171919986e8a202183146b6

It would be nice to support this version of nocashMessage as well. (And perhaps implement the "Emulation ID" register as seen in that GBATEK page as well.)

@zeromus
Copy link
Contributor

zeromus commented Oct 1, 2024

do other emulators support this

@lifehackerhansol
Copy link
Contributor Author

I tested it with no$gba debug emulator.

I am told that melonDS supports it as well, but I did not try it there.

@zeromus
Copy link
Contributor

zeromus commented Oct 1, 2024

If you post a test rom that exercises each case, I'll do it

@lifehackerhansol
Copy link
Contributor Author

nocash-register-test.zip

zip contains a ROM with char test case, a ROM with string test case, and the source if you needed it.

@zeromus
Copy link
Contributor

zeromus commented Oct 1, 2024

Hmm maybe you can help get started. We can work on these one at a time.

4FFFA00h..A0Fh R Emulation ID (16 bytes, eg. "no$gba v2.7", padded with 20h)

Set up a global flag following "emulate ensata" which is "emulate nocash". Don't worry about the stupid dialog box unless you're a windows programmer.

4FFFA10h W String Out (raw)

This one is easy

4FFFA14h W String Out (with %param's)
4FFFA18h W String Out (with %param's, plus linefeed)

These must have required hand-programming to approximate normal stdio behaviour? That's pretty crazy, and there's no way he did a perfect job. Making this work in desmume has bureaucratic implications and is a great idea to skip this one for now

4FFFA1Ch W Char Out (nocash)

This one is easy

4FFFA20h..A27h R Clock Cycles (64bit)

This one should not be hard, but getting the same "sense" as nocash (both in terms of which clock and with what sensible granularity) isn't completely trivial. At this point, given how old that code is in desmume, you have as good a shot as anyone else

@lifehackerhansol
Copy link
Contributor Author

lifehackerhansol commented Oct 1, 2024

So far I got String Out and Char Out: https://github.com/lifehackerhansol/desmume/tree/nocash-register-logging

For the Emulation ID I thought it would make sense to use DESMUME_NAME EMU_DESMUME_VERSION_NUMERIC(), but I don't have the best idea on how to iterate through that.

(As a side note, I don't have any clue what the Clock Cycle stuff is actually intended for...)

@zeromus
Copy link
Contributor

zeromus commented Oct 1, 2024

I think the clock cycle stuff is intended for measuring how long your game code takes to run. It can help optimize things.

Rather than output the desmume version, I would have it output nocash's string. In other words, it's saying that it's compatible with nocash.

If you want to add an extra signature in there, how about $DD at +3Fh? If you want to stick the version number near that, that's up to you. I don't think it's that important. We are not very disciplined with our version numbers. but I would just use the numeric portion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants