2018-07-27 17:39:09 +00:00
|
|
|
|
2018-08-13 22:17:36 +00:00
|
|
|
include "nesdefs.asm"
|
2018-07-27 17:39:09 +00:00
|
|
|
|
2018-08-13 22:17:36 +00:00
|
|
|
;;;;; VARIABLES
|
2018-07-27 17:39:09 +00:00
|
|
|
|
2018-08-13 22:17:36 +00:00
|
|
|
seg.u RAM
|
|
|
|
org $0
|
2018-07-27 17:39:09 +00:00
|
|
|
|
2018-08-13 22:17:36 +00:00
|
|
|
;;;;; NES CARTRIDGE HEADER
|
2018-07-27 17:39:09 +00:00
|
|
|
|
2018-08-13 22:17:36 +00:00
|
|
|
NES_HEADER 0,2,1,0 ; mapper 0, 2 PRGs, 1 CHR, vertical
|
2018-07-27 17:39:09 +00:00
|
|
|
|
2018-08-13 22:17:36 +00:00
|
|
|
;;;;; START OF CODE
|
2018-07-27 17:39:09 +00:00
|
|
|
|
2018-08-13 22:17:36 +00:00
|
|
|
Start:
|
|
|
|
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)
|
2018-07-27 17:39:09 +00:00
|
|
|
|
2018-08-13 22:17:36 +00:00
|
|
|
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
|
2018-07-27 17:39:09 +00:00
|
|
|
.endless
|
2018-08-13 22:17:36 +00:00
|
|
|
jmp .endless ; endless loop
|
2018-07-27 17:39:09 +00:00
|
|
|
|
2018-08-13 22:17:36 +00:00
|
|
|
;;;;; COMMON SUBROUTINES
|
2018-07-27 17:39:09 +00:00
|
|
|
|
2018-08-13 22:17:36 +00:00
|
|
|
include "nesppu.asm"
|
2018-07-27 17:39:09 +00:00
|
|
|
|
|
|
|
;;;;; INTERRUPT HANDLERS
|
|
|
|
|
2018-08-13 22:17:36 +00:00
|
|
|
NMIHandler:
|
2018-07-27 17:39:09 +00:00
|
|
|
rti
|
|
|
|
|
|
|
|
;;;;; CPU VECTORS
|
|
|
|
|
2018-08-13 22:17:36 +00:00
|
|
|
NES_VECTORS
|
2018-07-27 17:39:09 +00:00
|
|
|
|