-
Notifications
You must be signed in to change notification settings - Fork 2
/
sprite_sheet.asm
67 lines (55 loc) · 1.26 KB
/
sprite_sheet.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.include "x16.inc"
.org $080D
.segment "STARTUP"
.segment "INIT"
.segment "ONCE"
.segment "CODE"
jmp start
.include "filenames.asm"
spritesheet_fn: .asciiz "spritesheet.bin"
.include "loadvram.asm"
.include "globals.asm"
hscroll: .word 0
vscroll: .word 0
select_down: .byte 0
next_scale: .byte 128
start:
; Disable layers and sprites
lda VERA_dc_video
and #$8F
sta VERA_dc_video
; Setup tiles on layer 1
lda #$02 ; 32x32 map of 4bpp tiles
sta VERA_L1_config
lda #((VRAM_TILEMAP >> 9) & $FF)
sta VERA_L1_mapbase
lda #((((VRAM_TILES >> 11) & $3F) << 2) | $03) ; 16x16 tiles
sta VERA_L1_tilebase
stz VERA_L1_hscroll_l ; set scroll position to 0,0
stz VERA_L1_hscroll_h
stz VERA_L1_vscroll_l
stz VERA_L1_vscroll_h
; set display to 2x scale
lda #64
sta VERA_dc_hscale
sta VERA_dc_vscale
; load VRAM data from binaries
lda #>(VRAM_TILEMAP>>4)
ldx #<(VRAM_TILEMAP>>4)
ldy #<spritesheet_fn
jsr loadvram
lda #>(VRAM_TILES>>4)
ldx #<(VRAM_TILES>>4)
ldy #<sprites_fn
jsr loadvram
lda #>(VRAM_palette>>4)
ldx #<(VRAM_palette>>4)
ldy #<palette_fn
jsr loadvram
; enable layer 1
lda VERA_dc_video
ora #$20
sta VERA_dc_video
mainloop:
wai
bra mainloop