ASM Init
From GbdevWiki
; GB Initialization example
; RGBDS asm source
; David Pello 2012
INCLUDE "gbhw.inc" ; include GB hardware definitions
; vBlank interrupt
SECTION "Vblank",HOME[$0040]
reti ; nothing, return
; Program starts here:
SECTION "start",HOME[$0100]
nop
jp start
; ROM Header (gbhw.inc macro)
; MBC1 mapper, 64K rom, 8K RAM
ROM_HEADER ROM_MBC1_RAM_BAT, ROM_SIZE_64KBYTE, RAM_SIZE_8KBYTE
; program begins
start:
nop
di ; disables interrupts
ld sp, $fffe ; stack points to top of the high ram
init:
; palletes
ld a, %11100100 ; pallete colors from darker to
; lighter, 11 10 01 00
ld [rBGP], a ; write this at the background pallete register
ld [rOBP0], a ; and at the first sprites pallete
; scroll
ld a, 0 ; write 0 to scroll registers X and Y
ld [rSCX], a ; so visible screen is
ld [rSCY], a ; at the top left of the background.
; now, you can turn off the LCD and load tiles, sprites, maps, etc