-
Notifications
You must be signed in to change notification settings - Fork 1
/
scene_skrolli_logo.z80
99 lines (86 loc) · 2.11 KB
/
scene_skrolli_logo.z80
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
INCLUDE "Hardware.inc"
INCLUDE "rgbgrafx/rgbgrafx.inc"
Section "Skrolli Logo Data",DATA
INCLUDE "imagedata/skrolli_logo.inc"
Section "Skrolli Logo",CODE
scene_skrolli_logo::
di
call initialize_interrupts
ei
; Set all palette colors to black for the duration of loading image data
RGBG_WaitForVRAM
ld A, $FF
ld [rBGP], A
; Draw black window on top of background
; Store window tilemap in $9C00-$9FFF
ld A, $9C
ld [RGBG_tilemap], A
; Tile to fill the area of the map with
; We know the first tile in the Skrolli logo image is black
ld B, 0
ld H, 0 ; Y-coordinate of upper left corner of the area to set in VRAM
ld L, 0 ; X-coordinate of upper left corner of the area to set in VRAM
ld D, 32 ; Height of area in VRAM to set
ld E, 32 ; Width of area in VRAM to set
RGBG_WaitForVRAM
call RGBG_FillTileMap
; Set LCD control parameters
ld A, (LCDCF_ON | LCDCF_WIN9C00 | LCDCF_WINON | LCDCF_BGON | LCDCF_BG9800 | LCDCF_BG8000)
ld [rLCDC], A
; Initialize high byte of the tileset starting address
ld A, $80
ld [RGBG_tileset], A
; Load tile patterns to VRAM
ld BC, skrolli_tile_data
ld D, $FF
ld E, 0
RGBG_WaitForVRAM
call RGBG_LoadTiles
; Initialize high byte of the tilemap starting address
ld A, $98
ld [RGBG_tilemap], A
; Set tilemap offset to zero
xor A
ld [RGBG_map_offset], A
; Load tile map
RGBG_WaitForVRAM
ld BC, skrolli_map_data
ld H, $0
ld L, $0
ld E, skrolli_tile_map_width
ld D, skrolli_tile_map_height
call RGBG_SetTileMap
; Reset background scroll registers
xor A
ld [rSCX], A
ld [rSCY], A
; Reset color palette to default
RGBG_WaitForVRAM
ld A, %11100100
ld [rBGP], A
ld [rOBP0], A
ld [rOBP1], A
; Animate window sliding from left to right
xor A ; Set A to zero
add 7 ; Visible portion of window starts at rWX == 7
ld B, A
.loop
xor A
.innerloop
; Busywait to slow sliding window
inc A
cp $FF
jr nz, .innerloop
RGBG_WaitVBL
ld A, B
ld [rWX], A
inc A
ld B, A
cp 166 ; Visible portion of window ends at rWX == 166
jr nz, .loop
ld A, $FF
.delay_loop:
halt
dec A
jr nz, .delay_loop
ret