gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > VisualboyAdvance agbPrint howto?

#178811 - wjakobczyk - Thu Feb 01, 2018 9:23 am

Hi,

How can I use this VBA feature to print something to the emulators log, from my game code? I can't find any information on the net. I guess I can sort it out based on VBA's source code, but hopefully I don't have to :)

#178813 - Dwedit - Thu Feb 01, 2018 4:33 pm

VbaPrint is system call 0xFF, which will fail on actual hardware, but work fine on VBA and NO$GBA.

Example ASM function that will export vbaprint: (ARM mode)
Put this in a .s file, and include it in your makefile as needed.

Code: Select all

.arm
.global vbaprint
.type   vbaprint STT_FUNC
.text
vbaprint:
	swi 0xFF0000		@!!!!!!! Doesn't work on hardware !!!!!!!
	bx lr
C function signature for that asm code:
void vbaprint(const char *message);

#178815 - Sterophonick - Fri Feb 02, 2018 3:37 am

I had no clue that it was possble for a ROM to connect with emulators and for it to work with them, using features in the emulator itself. *clap clap* I wanna try this with Super Block Jump to see what happens.

Question: when running on actual hardware, does the system crash when this is performed?