aboutsummaryrefslogtreecommitdiff
path: root/space/src/vectors/nmi.s
blob: e049239d47ca296d7048b19389e2a42be230c2d8 (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
;; See `basics/sprite.s` for more info. I'm not doing anything fancier here.
nmi:
    bit $20
    bpl @next

    ;; Save registers.
    pha
    txa
    pha
    tya
    pha

    ;; We can start rendering stuff.
    OAM_WRITE_SPRITES

    ;; Reset scroll.
    bit $2002                   ; PPUSTATUS
    lda #$00
    sta $2005                   ; PPUSCROLL
    sta $2005                   ; PPUSCROLL

    ;; And unset the render flag so the `main` code is unblocked.
    UNSET_RENDER_FLAG

    ;; Restore registers.
    pla
    tay
    pla
    tax
    pla
@next:
    rti