Arvids Blog

Thoughts on programming and more

Debug Messages in no$gmb and BGB

I’ve recently started working on a little side project, involving Gameboy development. While reading through the docs of BGB, I noticed it supports printing debug messages to a debug console, I, however, couldn’t get it working, since it was using the syntax of the no$gmb assembler. Thanks to the people of #gbdev on EFnet, especially beware, I’ve eventually got it working, and made an rgbds macro out of it.

Without further ado, here is a gist of the it:

IF !DEF(DEBUG_INC)
DEBUG_INC SET 1

; Prints a message to the no$gmb / bgb debugger
; Accepts a string as input, see emulator doc for support
DBGMSG: MACRO
    ld d, d
    jr .end\@
    DW $6464
    DW $0000
    DB \1
.end\@:
    ENDM

ENDC ; DEBUG_INC