.include "testing.s"

reset:
        sei
        cld ; disabled decimal mode (iirc it doesn't work properly on NES anyway)
        ldx #$40
        stx $4017 ; Disable APU frame IRQ
        ldx #$ff
        txs ; Set stack pointer to 0x1ff
        inx ; Set x to zero
        stx $2000 ; Disable NMI (by writing zero)
        stx $2001 ; Disable rendering
        stx $4010 ; Disable DMC IRQs

        bit $2002 ; Clear vblank flag by reading ppu status
VBLANKWAIT1:
        bit $2002
        bpl VBLANKWAIT1
        stp
        stp

nmi:
        stp

irq:
        stp
