2018-08-14 20:28:29 +00:00
|
|
|
|
|
|
|
include "nesdefs.asm"
|
|
|
|
|
|
|
|
;;;;; VARIABLES
|
|
|
|
|
|
|
|
seg.u RAM
|
|
|
|
org $0
|
|
|
|
|
|
|
|
;;;;; NES CARTRIDGE HEADER
|
|
|
|
|
2018-08-17 02:45:59 +00:00
|
|
|
NES_HEADER 0,2,1,NES_MIRR_HORIZ ; mapper 0, 2 PRGs, 1 CHR
|
2018-08-14 20:28:29 +00:00
|
|
|
|
|
|
|
;;;;; START OF CODE
|
|
|
|
|
2018-08-17 02:45:59 +00:00
|
|
|
Start: subroutine
|
2018-08-14 20:28:29 +00:00
|
|
|
NES_INIT ; set up stack pointer, turn off PPU
|
|
|
|
jsr WaitSync ; wait for VSYNC
|
|
|
|
jsr ClearRAM ; clear RAM
|
|
|
|
jsr WaitSync ; wait for VSYNC (and PPU warmup)
|
|
|
|
|
|
|
|
lda #$3f ; $3F -> A register
|
|
|
|
ldy #$00 ; $00 -> Y register
|
|
|
|
sta PPU_ADDR ; write high byte first
|
|
|
|
sty PPU_ADDR ; $3F00 -> PPU address
|
|
|
|
lda #$1c ; $1C = light blue color
|
|
|
|
sta PPU_DATA ; $1C -> PPU data
|
|
|
|
lda #CTRL_NMI
|
|
|
|
sta PPU_CTRL ; enable NMI
|
|
|
|
lda #MASK_COLOR
|
|
|
|
sta PPU_MASK ; enable rendering
|
|
|
|
.endless
|
|
|
|
jmp .endless ; endless loop
|
|
|
|
|
|
|
|
;;;;; COMMON SUBROUTINES
|
|
|
|
|
|
|
|
include "nesppu.asm"
|
|
|
|
|
|
|
|
;;;;; INTERRUPT HANDLERS
|
|
|
|
|
2018-08-17 02:45:59 +00:00
|
|
|
NMIHandler: subroutine
|
|
|
|
SAVE_REGS
|
|
|
|
RESTORE_REGS
|
2018-08-14 20:28:29 +00:00
|
|
|
rti
|
|
|
|
|
|
|
|
;;;;; CPU VECTORS
|
|
|
|
|
|
|
|
NES_VECTORS
|
|
|
|
|