More realistic background.
This commit is contained in:
parent
ffd584c19e
commit
fe0ae0d008
63
pewpew.asm
63
pewpew.asm
@ -54,9 +54,9 @@ Start:
|
||||
jsr LoadPaletteAndTileData
|
||||
jsr InitializeSpriteTables
|
||||
|
||||
; Set screen mode: 16x16 tiles for BG2, 8x8 tiles elsewhere, mode 0.
|
||||
lda #%00100000
|
||||
sta BGMODE
|
||||
; Set screen mode: 16x16 tiles for backgrounds, mode 0.
|
||||
lda #%11110000
|
||||
sta SCREENMODE
|
||||
|
||||
; Set sprite size to 16x16 (small) and 32x32 (large).
|
||||
lda #%01100000
|
||||
@ -87,10 +87,8 @@ Start:
|
||||
; Write something recognizable into our scratch space.
|
||||
jsr FillScratch
|
||||
|
||||
; Start the background color as a sky blue.
|
||||
lda #16
|
||||
sta $23
|
||||
lda #31
|
||||
; Start the background color as a dark blue.
|
||||
lda #4
|
||||
sta $24
|
||||
|
||||
; Player's initial starting location.
|
||||
@ -202,6 +200,13 @@ LoadPaletteAndTileData:
|
||||
lda #%00000001
|
||||
sta DMAENABLE
|
||||
|
||||
; Tell the system that the BG2 tilemap starts at $4000.
|
||||
lda #%00100000
|
||||
sta BG2TILEMAP
|
||||
; ... and that the background tile data for BG1 & BG2 starts at $2000.
|
||||
lda #%00010001
|
||||
sta BG12NBA
|
||||
|
||||
; Set up the BG2 tilemap.
|
||||
; VRAM write mode: increments the address every time we write a word.
|
||||
lda #%10000000
|
||||
@ -210,21 +215,38 @@ LoadPaletteAndTileData:
|
||||
ldx #$2000 ; BG 2 tilemap starts here. (Byte address $4000.)
|
||||
stx VMADDR
|
||||
; Now write entries into the tile map.
|
||||
; We have only a couple tiles, but we set the invert horizontal/vertical
|
||||
; bits so that we get more variation. We also do 7 tiles per loop -- since
|
||||
; the tile map is 32 entries wide, this means that successive rows end up
|
||||
; looking different.
|
||||
ldy #0
|
||||
-
|
||||
ldx #$0002 ; Write one tile into the map.
|
||||
ldx #$0002
|
||||
stx VMDATA
|
||||
iny
|
||||
cpy #1024 ; The tile map is 32x32 (1024 entries).
|
||||
ldx #$0004
|
||||
stx VMDATA
|
||||
iny
|
||||
ldx #$4002
|
||||
stx VMDATA
|
||||
iny
|
||||
ldx #$8002
|
||||
stx VMDATA
|
||||
iny
|
||||
ldx #$8004
|
||||
stx VMDATA
|
||||
iny
|
||||
ldx #$A002
|
||||
stx VMDATA
|
||||
iny
|
||||
ldx #$A004
|
||||
stx VMDATA
|
||||
iny
|
||||
; The tile map is 32x32 (1024 entries).
|
||||
; This is the next multiple of 7 above that.
|
||||
cpy #1029
|
||||
bne -
|
||||
|
||||
; The BG2 tilemap starts at $4000.
|
||||
lda #%00100000
|
||||
sta BG2TILEMAP
|
||||
; Background tile data for BG1 & BG2 starts at $2000.
|
||||
lda #%00010001
|
||||
sta BG12NBA
|
||||
|
||||
rts
|
||||
|
||||
|
||||
@ -475,11 +497,18 @@ UpdateGraphics:
|
||||
and #%11111110
|
||||
sta $0300
|
||||
|
||||
; Make the background scroll.
|
||||
; Make the background scroll. Horizontal over time; vertical depending on
|
||||
; player's y-coordinate.
|
||||
lda $14
|
||||
sta BG2HOFS
|
||||
lda $15
|
||||
sta BG2HOFS
|
||||
lda $21
|
||||
.rept 3
|
||||
lsr
|
||||
.endr
|
||||
sta BG2VOFS
|
||||
stz BG2VOFS
|
||||
|
||||
rts
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
; d: BG1 tile size (0=8x8, 1=16x16).
|
||||
; e: Highest priority for BG3 in MODE 1.
|
||||
; f: MODE definition.
|
||||
.define BGMODE $2105
|
||||
.define SCREENMODE $2105
|
||||
|
||||
; $2107-210A: BG1-4 tilemap registers [BGxSC]
|
||||
; xxxxxxab x: Base address (in VRAM, shifted left 11 bits).
|
||||
|
20
tiles.asm
20
tiles.asm
@ -3,11 +3,10 @@
|
||||
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 $07, $00, $18, $07, $20, $1F, $4C, $33, $50, $2F, $86, $79, $86, $79, $80, $7F
|
||||
.db $E0, $00, $18, $E0, $04, $F8, $32, $CC, $0A, $F4, $61, $9E, $61, $9E, $01, $FE
|
||||
.db $10, $00, $28, $10, $A8, $90, $64, $58, $E3, $DC, $30, $0F, $AC, $93, $60, $5F
|
||||
.db $00, $00, $00, $00, $00, $00, $F8, $00, $80, $00, $70, $80, $0E, $F0, $01, $FE
|
||||
.db $80, $00, $80, $00, $80, $00, $80, $00, $80, $00, $80, $00, $80, $00, $80, $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, $20, $00, $00, $00, $00
|
||||
.db $00, $00, $00, $00, $00, $10, $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, $04
|
||||
.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
|
||||
@ -19,11 +18,12 @@ 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 $80, $7F, $9F, $60, $9F, $6F, $4F, $37, $47, $38, $20, $1F, $18, $07, $07, $00
|
||||
.db $01, $FE, $F9, $06, $F9, $F6, $F2, $EC, $E2, $1C, $04, $F8, $18, $E0, $E0, $00
|
||||
.db $60, $5F, $AC, $93, $30, $0F, $E3, $DC, $64, $58, $A8, $90, $28, $10, $10, $00
|
||||
.db $01, $FE, $0E, $F0, $70, $80, $80, $00, $F8, $00, $00, $00, $00, $00, $00, $00
|
||||
.db $80, $00, $80, $00, $80, $00, $80, $00, $80, $00, $80, $00, $80, $00, $80, $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, $08, $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
|
||||
|
||||
TilePalette:
|
||||
|
Loading…
Reference in New Issue
Block a user