
init_ppu_and_wait:
	; Init PPU
	bit PPUSTATUS
vwait1:
	bit PPUSTATUS
	bpl vwait1
vwait2:
	bit PPUSTATUS
	bpl vwait2

	lda #$80
	sta PPUCTRL ; NMI on, PPU slave, Small sprites, 0 addresses
	lda #$00
infinite_loop:
	jmp infinite_loop

.macro nmi_start
	pha
	txa
	pha
	tya
	pha
	lda PPUSTATUS
	lda #%00000110
	sta PPUMASK ; Force blank
.endmacro
.macro nmi_end
	lda #%00001110
	sta PPUMASK ; Enable rendering
	pla
	tay
	pla
	tax
	pla
	rti
.endmacro
