Assembly Language - Control Page Init: Difference between revisions
From NerdConsole
Jump to navigationJump to search
NerdOfEpic (talk | contribs) (Created page with "<syntaxhighlight lang="ca65" line> </syntaxhighlight> Back to the list of Assembly Language files.") |
NerdOfEpic (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
<syntaxhighlight lang="ca65" line> | <syntaxhighlight lang="ca65" line> | ||
; 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 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Back to the list of [[Assembly Language]] files. | Back to the list of [[Assembly Language]] files. | ||
Latest revision as of 14:05, 14 January 2024
; 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.