Compare commits

...

3 Commits

Author SHA1 Message Date
Greg Shuflin
379d1c88fc Revert "Temporarily change color to green"
This reverts commit 8ff3cb63da.
2022-06-13 17:12:37 -07:00
Greg Shuflin
8ff3cb63da Temporarily change color to green
To make sure the tile is changing
2022-06-13 17:12:24 -07:00
Greg Shuflin
7e8671c071 Part 2 2022-06-13 17:09:27 -07:00
2 changed files with 104 additions and 4 deletions

View File

@ -0,0 +1,38 @@
charset:
; tile 0x00
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
; tile 0x01
.byte %11111111 ; row 0, color 0
.byte %00000000 ; row 0, color 1
.byte %10000001 ; row 1, color 0
.byte %00000000 ; row 1, color 1
.byte %10000001 ; row 2, color 0
.byte %00000000 ; row 2, color 1
.byte %10000001 ; row 3, color 0
.byte %00001000 ; row 3, color 1
.byte %10011001 ; row 4, color 0
.byte %00001000 ; row 4, color 1
.byte %10000001 ; row 5, color 0
.byte %00000000 ; row 5, color 1
.byte %10000001 ; row 6, color 0
.byte %00000000 ; row 6, color 1
.byte %11111111 ; row 7, color 0
.byte %00000000 ; row 7, color 1
charset_end:

View File

@ -8,19 +8,79 @@
.segment "CODE"
VRAM_CHARS = $0000
VRAM_BG1 = $1000
start:
.include "init.asm"
; Set up the color palette
stz CGADD
; Set color zero to some color
; $001f = %0000000000011111
; bbbbbgggggrrrrr
lda #$ff
; Color 0 - black
lda #$00
sta CGDATA
lda #$00
sta CGDATA
; Color 1 - red
lda #$1f
sta CGDATA
lda #$00
sta CGDATA
; Color 2 - blue
lda #$e0
sta CGDATA
lda #$03
sta CGDATA
; Color 3 - green
lda #$00
sta CGDATA
lda #$7c
sta CGDATA
; Graphics mode 0, 8x8 tiles
stz BGMODE
; Set BG1 and tile map and character data
lda #>VRAM_BG1
sta BG1SC
lda #VRAM_CHARS
sta BG12NBA
; Load character data into VRAM
lda #$80
sta VMAIN
ldx #VRAM_CHARS
stx VMADDL
@charset_loop:
lda charset,x
sta VMDATAL
inx
lda charset,x
sta VMDATAH
inx
cpx #(charset_end - charset)
bne @charset_loop
; write tile to position (1, 1)
TILE_X = 1
TILE_Y = 1
ldx #(VRAM_BG1 + (TILE_Y * 32) + TILE_X)
stx VMADDL
lda #$01 ; tile number
sta VMDATAL
stz VMDATAH
; Show bg1
lda #%00000001
sta TM
lda #$0f
sta INIDISP
@ -31,3 +91,5 @@ nmi:
bit RDNMI
_rti:
rti
.include "charset.asm"