Skip to content

Instantly share code, notes, and snippets.

@SelvinPL
Created May 5, 2025 22:09
Show Gist options
  • Select an option

  • Save SelvinPL/2b2bac267a710642fb2d1a683c199995 to your computer and use it in GitHub Desktop.

Select an option

Save SelvinPL/2b2bac267a710642fb2d1a683c199995 to your computer and use it in GitHub Desktop.
rSB log test
INCLUDE "hardware.inc"
SECTION "HRAM", HRAM
wait_for_vblank:
ds 1
SECTION "VBLANK", ROM0[INT_HANDLER_VBLANK]
push af
xor a
ldh [wait_for_vblank], a
pop af
reti
SECTION "HEADER", ROM0[$100]
jp EntryPoint
ds $150 - @, 0
EntryPoint:
; Shut down audio circuitry
ldh [rNR52], a
ld hl, $e000
ld sp, hl
ld a, IEF_VBLANK | IEF_STAT
ldh [rIE], a
ei
: call WaitVBlank
ld a, 0 ; start by writing the byte 0 to the output. this is non-ascii
rept 8 ; try writing eight times
ld [rSB], a
inc a ; increment the byte we're sending just so we get variety in the logs
endr
jr :-
WaitVBlank::
push af
ld a, 1
ldh [wait_for_vblank], a
: halt
nop
ldh a, [wait_for_vblank]
or a
jr nz, :-
pop af
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment