-
Notifications
You must be signed in to change notification settings - Fork 1
/
scene_cover.z80
91 lines (74 loc) · 1.69 KB
/
scene_cover.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
INCLUDE "Hardware.inc"
INCLUDE "rgbgrafx/rgbgrafx.inc"
Section "Magazine cover data",HOME
INCLUDE "imagedata/magazine_cover.inc"
Section "Magazine cover scene",CODE
scene_cover::
di
; When timer interrupt triggers, load 0 to TIMA
xor A
ld [rTMA], A
; Initialize timer variable to zero
ld [timer], A
; Reset interrupt handlers
call initialize_interrupts
; Set timer interrupt
ld BC, cover_timer
call set_timer_interrupt
; Enable V-blank and timer interrupts
ld A, IEF_VBLANK | IEF_TIMER
ld [rIE], A
ei
; Set all palette colors to black for the duration of loading image data
RGBG_WaitForVRAM
ld A, $FF
ld [rBGP], A
; Set LCD control parameters
ld A, (LCDCF_ON | LCDCF_WINOFF | 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, magazine_cover_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, magazine_cover_map_data
ld H, $0
ld L, $0
ld E, magazine_cover_tile_map_width
ld D, magazine_cover_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
.loop:
halt
ld A, [timer]
cp 160
jr nz, .loop
ret
cover_timer:
ld A, [timer]
inc A
ld [timer], A
ret
Section "Magazine cover variables",BSS
timer: DS 1