aboutsummaryrefslogtreecommitdiff
path: root/init.gbasm
blob: 20a5461d62846ebd2846af3744f96b3a086a83e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
.PADTO 0x0040
VBlank:
	CALL =VBLANK_Entrypoint
	RETI

.PADTO 0x0100
Start:
	JP =Empty_VRAM

.PADTO 0x0104
Nintendo_Logo: ; The Nintendo logo must be stored in bytes 0x104-133
	.DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D 
	.DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99 
	.DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E 
	
.PADTO 0x0134
Checksum: ; The bytes 0x134-0x14d need to add up to 0xe7 (= 0xff - 0x19)
	.DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
	.DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$e7

Empty_VRAM: ; (Clear screen)
	LD hl, $VRAM_start ; We set the HL register to the start of VRAM

Empty_VRAM.loop:
		XOR A
		LD (HL+), a 						; We set the memory pointed to by HL to 0 and increase HL
		LD a, $a0
		CP h        						; Until h has reached $a0 ($a0000 is the end of VRAM)
		JR NZ, =Empty_VRAM.loop

	; BG Palette
	LD A, $e4
	LD $reg_bg_palette, A
	
	; OBJ0 Palette
	LD A, $e4
	LD $reg_obj0_palette, A
	
	; LCDC
	LD A, $reg_lcd_controller
	OR $06
	LD $reg_lcd_controller, A

	; Interrupts
	LD A, $01
	LD $reg_interrupt_enable, A

	JP =Entrypoint