2018-07-27 13:39:09 -04:00
|
|
|
|
2019-05-10 21:25:21 -04:00
|
|
|
include "nesdefs.dasm"
|
2018-07-27 13:39:09 -04:00
|
|
|
|
2018-08-13 18:17:36 -04:00
|
|
|
;;;;; VARIABLES
|
2018-07-27 13:39:09 -04:00
|
|
|
|
2019-08-03 17:23:38 -04:00
|
|
|
seg.u ZEROPAGE
|
2018-08-13 18:17:36 -04:00
|
|
|
org $0
|
2018-07-27 13:39:09 -04:00
|
|
|
|
2018-08-13 18:17:36 -04:00
|
|
|
;;;;; NES CARTRIDGE HEADER
|
2018-07-27 13:39:09 -04:00
|
|
|
|
2019-02-21 14:19:29 -05:00
|
|
|
NES_HEADER 0,2,1,0 ; mapper 0, 2 PRGs, 1 CHR, horiz. mirror
|
2018-07-27 13:39:09 -04:00
|
|
|
|
2018-08-13 18:17:36 -04:00
|
|
|
;;;;; START OF CODE
|
2018-07-27 13:39:09 -04:00
|
|
|
|
2018-08-13 18:17:36 -04:00
|
|
|
Start:
|
2019-03-02 17:15:03 -06:00
|
|
|
; wait for PPU warmup; clear CPU RAM
|
2018-08-13 18:17:36 -04: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)
|
2019-03-02 17:15:03 -06:00
|
|
|
; set palette
|
2018-08-13 18:17:36 -04:00
|
|
|
lda #$3f ; $3F -> A register
|
|
|
|
sta PPU_ADDR ; write high byte first
|
2019-02-28 16:08:41 -05:00
|
|
|
lda #$00 ; $00 -> A register
|
|
|
|
sta PPU_ADDR ; $3F00 -> PPU address
|
2018-08-13 18:17:36 -04:00
|
|
|
lda #$1c ; $1C = light blue color
|
|
|
|
sta PPU_DATA ; $1C -> PPU data
|
2019-03-02 17:15:03 -06:00
|
|
|
; activate PPU graphics
|
2019-07-13 14:31:10 -04:00
|
|
|
lda #MASK_BG ; A = $08
|
2018-08-13 18:17:36 -04:00
|
|
|
sta PPU_MASK ; enable rendering
|
2019-07-13 14:31:10 -04:00
|
|
|
lda #CTRL_NMI ; A = $80
|
2019-04-26 15:38:34 -04:00
|
|
|
sta PPU_CTRL ; enable NMI
|
2018-07-27 13:39:09 -04:00
|
|
|
.endless
|
2018-08-13 18:17:36 -04:00
|
|
|
jmp .endless ; endless loop
|
2018-07-27 13:39:09 -04:00
|
|
|
|
2018-08-13 18:17:36 -04:00
|
|
|
;;;;; COMMON SUBROUTINES
|
2018-07-27 13:39:09 -04:00
|
|
|
|
2019-05-10 21:25:21 -04:00
|
|
|
include "nesppu.dasm"
|
2018-07-27 13:39:09 -04:00
|
|
|
|
|
|
|
;;;;; INTERRUPT HANDLERS
|
|
|
|
|
2018-08-13 18:17:36 -04:00
|
|
|
NMIHandler:
|
2018-07-27 13:39:09 -04:00
|
|
|
rti
|
|
|
|
|
|
|
|
;;;;; CPU VECTORS
|
|
|
|
|
2018-08-13 18:17:36 -04:00
|
|
|
NES_VECTORS
|
2018-07-27 13:39:09 -04:00
|
|
|
|