Assembly Language - Control Page Init

From NerdConsole
Jump to navigationJump to search
; Purpose: This routine initializes the control page registers
;          into a useful starting state.
; For: NerdConsole (65C02 Assembly, ca65 format)
; By: David Stephens (NerdOfEpic)
; License: Public Domain - Can be used or modified by anyone 
;                          for any purpose.


	; Initialize the whole control page to 0
	ldx #$00
ZeroControlPage:
	stz $0200,x
	inx
	bne ZeroControlPage

	; Set the control page registers that need special values
	; Set the graphics mode to High (16 color tiles) 
	lda #$03
	sta $02FF  ; Graphics Mode
	; Set all cycle speeds to 1 update per second
	lda #$3B
	sta $0288  ; BG Color Cycle
	sta $0289  ; Sprite Color Cycle
	sta $02A9  ; BG Tile Set Cycle
	sta $02AB  ; Sprite Tile Set Cycle
	; Use all sprites (turn this down later)
	lda #$FF
	sta $0290  ; Last Sprite
	; Enable all PPU features except Debug
	lda #$7F
	sta $02F8  ; Active Features
	sta $02F9  ; Active Features

Back to the list of Assembly Language files.