Add a happy-face tile.

This commit is contained in:
Colin McMillen 2015-05-23 17:17:39 -04:00
parent 83e0e26e29
commit 41155fadec
3 changed files with 31 additions and 37 deletions

View File

@ -70,7 +70,9 @@ Start:
; Write something recognizable into our scratch space. ; Write something recognizable into our scratch space.
jsr FillScratch jsr FillScratch
; Start the background color as a dark blue. ; Start the background color as a lime green.
lda #31
sta $23
lda #16 lda #16
sta $24 sta $24
@ -97,20 +99,22 @@ LoadPaletteAndTileData:
; 16-bit X/Y registers. Used for DMA source address & transfer size, both of ; 16-bit X/Y registers. Used for DMA source address & transfer size, both of
; which want 16-bit values. ; which want 16-bit values.
; TODO(mcmillen): change back to 8-bit when we're done?
rep #%00010000 rep #%00010000
; 8-bit A/B registers. Used for DMA source bank & destination address. ; 8-bit A/B registers. Used for DMA source bank & destination address.
sep #%00100000 sep #%00100000
; We only need one palette entry, so we just initialize it manually. ; Initialize the palette memory in a loop.
; We could also do this with a DMA transfer (like we do with the tile data ; We could also do this with a DMA transfer (like we do with the tile data
; below), but it seems overkill for just one entry :) ; below), but it seems overkill for just a few bytes. :)
lda #34 ; Set the 34th palette entry. ldx #0
lda #32 ; Palette entries for BG2 start at 32.
sta CGADDR sta CGADDR
lda.l PaletteData -
sta CGDATA lda.l PaletteData, x
lda.l PaletteData + 1
sta CGDATA sta CGDATA
inx
cpx #8 ; 8 bytes of palette data.
bne -
; DMA 0 source address & bank. ; DMA 0 source address & bank.
ldx #TileData ldx #TileData
@ -118,7 +122,7 @@ LoadPaletteAndTileData:
lda #:TileData lda #:TileData
sta DMA0SRCBANK sta DMA0SRCBANK
; DMA 0 transfer size. ; DMA 0 transfer size.
ldy #(15 * 16 *2) ; Also see the helpful "480 bytes" comment in tiles.asm. ldy #320 ; See the helpful comment in face.asm.
sty DMA0SIZE sty DMA0SIZE
; DMA 0 control register. ; DMA 0 control register.
; Transfer type 001 = 2 addresses, LH. ; Transfer type 001 = 2 addresses, LH.
@ -140,7 +144,7 @@ LoadPaletteAndTileData:
; Set word address for accessing VRAM to $6000. ; Set word address for accessing VRAM to $6000.
ldx #$6000 ; BG 2 starts here. ldx #$6000 ; BG 2 starts here.
stx VMADDR stx VMADDR
ldx #$000A ; Stick one tile into BG2. ldx #$0002 ; Stick one tile into BG2.
stx VMDATA stx VMDATA
; Set up the screen. 16x16 tiles for BG2, 8x8 tiles elsewhere, mode 0. ; Set up the screen. 16x16 tiles for BG2, 8x8 tiles elsewhere, mode 0.

View File

@ -3,37 +3,27 @@
TileData: TileData:
.db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03 .db $07, $00, $18, $07, $20, $1F, $4C, $33, $50, $2F, $86, $79, $86, $79, $80, $7F
.db $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0 .db $E0, $00, $18, $E0, $04, $F8, $32, $CC, $0A, $F4, $61, $9E, $61, $9E, $01, $FE
.db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $FF, $FF, $FF, $FF
.db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $FF, $FF, $FF, $FF
.db $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $FF, $FF, $FF, $FF
.db $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $FF, $FF, $FF, $FF
.db $00, $C0, $00, $E0, $00, $70, $00, $38, $00, $1C, $00, $0E, $00, $07, $00, $03
.db $00, $03, $00, $07, $00, $0E, $00, $1C, $00, $38, $00, $70, $00, $E0, $00, $C0
.db $00, $07, $00, $0F, $00, $18, $00, $30, $00, $60, $00, $C0, $00, $C0, $00, $C0
.db $00, $E0, $00, $F0, $00, $18, $00, $0C, $00, $06, $00, $03, $00, $03, $00, $03
.db $FC, $00, $F8, $00, $F0, $00, $E0, $00, $C0, $00, $80, $00, $00, $00, $00, $00
.db $3F, $00, $1F, $00, $0F, $00, $07, $00, $03, $00, $01, $00, $00, $00, $00, $00
.db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $FF, $FF, $FF, $FF, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $FF, $FF, $FF, $FF, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $FF, $FF, $FF, $FF, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $FF, $FF, $FF, $FF, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0, $C0 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $00, $03, $00, $07, $00, $0E, $00, $1C, $00, $38, $00, $70, $00, $E0, $00, $C0 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $00, $C0, $00, $E0, $00, $70, $00, $38, $00, $1C, $00, $0E, $00, $07, $00, $03 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $00, $C0, $00, $C0, $00, $C0, $00, $60, $00, $30, $00, $18, $00, $0F, $00, $07 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $00, $03, $00, $03, $00, $03, $00, $06, $00, $0C, $00, $18, $00, $F0, $00, $E0 .db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.db $00, $00, $00, $00, $80, $00, $C0, $00, $E0, $00, $F0, $00, $F8, $00, $FC, $00 .db $80, $7F, $9F, $60, $9F, $6F, $4F, $37, $47, $38, $20, $1F, $18, $07, $07, $00
.db $00, $00, $00, $00, $01, $00, $03, $00, $07, $00, $0F, $00, $1F, $00, $3F, $00 .db $01, $FE, $F9, $06, $F9, $F6, $F2, $EC, $E2, $1C, $04, $F8, $18, $E0, $E0, $00
PaletteData: PaletteData:
.db $FF, $7F .db $1F, $7C, $00, $00, $FF, $7F, $1F, $00
; 30 tiles (2 spaces) ; 20 tiles (12 spaces)
; 480 bytes ; 320 bytes

BIN
tiles.pcx Normal file

Binary file not shown.