Page 1 of 1

Logging for emulators other than No$GBA?

Posted: Sun Jan 09, 2022 11:15 am
by FireFox
Hello, no$gba has a logging function under Windows -> TTY debug messages, I was wondering if other emulators have a similar feature as the logging is pretty much one of the main reasons I'm using nocash even though it's definitely less accurate.
I've noticed that VBA has some kind of reference to AGBPrint, but I can't seem to find any documentation as to what this actually is and was wondering if this is similar to the tty messages and I'm meant to be able to hook into it somehow? Any info would be appreciated, thanks.

Re: Logging for emulators other than No$GBA?

Posted: Wed Jan 26, 2022 2:18 am
by FireFox
Finally found the answer to this over on a couple of old forum posts in gbadev.org for VBA, honestly annoyingly difficult to find this info so reposting it here.
Just needs a bios call to 0xFF. Note it does fail on actual hardware.

Code: Select all

#if	defined	( __thumb__ )
#define	BiosSystemCall(Number)	 __asm ("SWI	  "#Number"\n" :::  "r0", "r1", "r2", "r3")
#else
#define	BiosSystemCall(Number)	 __asm ("SWI	  "#Number"	<< 16\n" :::"r0", "r1", "r2", "r3")
#endif

// Don't let the compiler optimise seemingly empty bios call statements away
#pragma GCC push_options
#pragma GCC optimize ("O0")

	// Will crash on actual hardware
	inline void AGBPrint(const char* message)
	{
		BiosSystemCall(0xFF);
	}

#pragma GCC pop_options