1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-27 01:51:35 +00:00
8bitworkshop/presets/nes/ex0.dasm

49 lines
973 B
Plaintext
Raw Normal View History

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