mirror of
https://github.com/deater/tb1.git
synced 2025-01-27 15:32:30 +00:00
snes: added generic palette load function
Uses DMA
This commit is contained in:
parent
f217ef0d41
commit
011aeb54cc
@ -1,3 +1,9 @@
|
||||
; Fade in
|
||||
; Display the Opening VMW Logo
|
||||
; eventually play music
|
||||
; wait until button pressed
|
||||
; Fade out
|
||||
|
||||
.segment "STARTUP"
|
||||
|
||||
|
||||
|
@ -3,10 +3,11 @@
|
||||
|
||||
.segment "STARTUP"
|
||||
|
||||
|
||||
;====================================
|
||||
;====================================
|
||||
; Move Sprites Offscreen
|
||||
;====================================
|
||||
;====================================
|
||||
|
||||
svmw_move_sprites_offscreen:
|
||||
|
||||
@ -49,10 +50,12 @@ set_top:
|
||||
plp
|
||||
|
||||
|
||||
;=====================================
|
||||
; transfer sprite
|
||||
; assumes sprite_data starts at $7e:0000
|
||||
;=====================================
|
||||
;========================================
|
||||
;========================================
|
||||
; transfer sprite
|
||||
; assumes sprite_data starts at $7e:0000
|
||||
;========================================
|
||||
;========================================
|
||||
|
||||
svmw_transfer_sprite:
|
||||
php ; save status word
|
||||
@ -100,3 +103,42 @@ svmw_transfer_sprite:
|
||||
plp ; restore status word
|
||||
|
||||
rts
|
||||
|
||||
|
||||
;==================================
|
||||
;==================================
|
||||
; Load Compressed Tilemap
|
||||
; This loads a tilemap made with my pcx_to_compressed_tilemap tool
|
||||
;==================================
|
||||
;==================================
|
||||
|
||||
|
||||
;==============
|
||||
;==============
|
||||
; Load Palette
|
||||
; Bank in A
|
||||
; Address in X
|
||||
; Colors in Y*2
|
||||
; Color offset written to $2121 in advance
|
||||
;==============
|
||||
;==============
|
||||
|
||||
svmw_load_palette:
|
||||
php ; save status on stack
|
||||
|
||||
rep #$10 ; 16 bit X/Y
|
||||
.i16
|
||||
sep #$20 ; 8 bit A
|
||||
.a8
|
||||
stx $4302 ; Store data offset into DMA source offset
|
||||
sta $4304 ; Store data bank into DMA source bank
|
||||
sty $4305 ; Store size of data block
|
||||
|
||||
stz $4300 ; Set DMA Mode (byte, normal increment)
|
||||
lda #$22 ; Set destination register ($2122 - CGRAM Write)
|
||||
sta $4301
|
||||
lda #$01 ; Initiate DMA transfer
|
||||
sta $420b
|
||||
|
||||
plp ; restore status
|
||||
rts
|
||||
|
@ -46,20 +46,11 @@ display_title:
|
||||
;==============
|
||||
; Load Palettes
|
||||
;==============
|
||||
.a8
|
||||
.i16
|
||||
stz $2121 ; CGRAM color-generator read/write address
|
||||
|
||||
ldy #$0200 ; we have 256 colors / 512 bytes
|
||||
|
||||
ldx #$0000 ; pointer
|
||||
copypal:
|
||||
lda f:title_screen_palette, x ; load byte of palette
|
||||
sta $2122 ; store to color generator
|
||||
inx
|
||||
dey
|
||||
bne copypal
|
||||
|
||||
stz $2121 ; start with color 0
|
||||
ldy #(256*2) ; we have 256 colors
|
||||
lda #^title_screen_palette
|
||||
ldx #.LOWORD(title_screen_palette)
|
||||
jsr svmw_load_palette
|
||||
|
||||
;=====================
|
||||
; Load Tile Data
|
||||
|
Loading…
x
Reference in New Issue
Block a user