-
Notifications
You must be signed in to change notification settings - Fork 2
/
PerFade.asm
581 lines (541 loc) · 17.3 KB
/
PerFade.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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
section "PerFade RAM",wram0,align[8]
sys_PalTransferBuf:
sys_BGPalTransferBuf:: ds (2*4)*8 ; 8 PalTransferBuf, 4 colors per palette, 2 bytes per color
sys_ObjPalTransferBuf:: ds (2*4)*8 ; 8 PalTransferBuf, 4 colors per palette, 2 bytes per color
sys_PalBuffer:
sys_BGPalBuffer:: ds (3*4)*8 ; BG palette work area (8 PalTransferBuf, 4 colors per palette, 3 bytes per color)
sys_ObjPalBuffer:: ds (3*4)*8 ; OBJ palette work area (8 PalTransferBuf, 4 colors per palette, 3 bytes per color)
sys_Palettes:
sys_BGPalettes: ds (2*4)*8 ; main BG palette
sys_ObjPalettes: ds (2*4)*8 ; main OBJ palette
sys_PalBuffersEnd:
sys_FadeState:: db ; bit 0 = fading, bit 1 = fade type (0 = white, 1 = black), bit 1 = fade dir (0 = in, 1 = out)
sys_FadeLevel:: db ; current intensity level
section "PerFade routines",rom0
; INPUT: a = color index to modify
; hl = color
; DESTROYS: a, b, hl
SetColor::
push de
and 15
bit 3,a
jr nz,.obj
add a ; x2
ld b,a
ld de,sys_BGPalTransferBuf
add e
ld e,a
ld a,h
ld [de],a
inc e
ld a,l
ld [de],a
pop de
ret
.obj
add a ; x2
add a ; x4
add a ; x8
ld b,a
ld de,sys_ObjPalTransferBuf
add e
ld e,a
ld a,h
ld [de],a
inc e
ld a,l
ld [de],a
pop de
ret
; Routines to initialize palette fading
; INPUT: b = BG palette mask
; c = OBJ palette mask
; DESTROYS: a
PalFadeInWhite:
call AllPalsWhite
ld a,%00000001
ld e,31
jr _InitFade
PalFadeOutWhite:
ld a,%00000101
ld e,0
jr _InitFade
PalFadeInBlack:
call AllPalsBlack
ld a,%00000011
ld e,31
jr _InitFade
PalFadeOutBlack:
ld a,%00000111
ld e,0
; fall through
_InitFade:
ld [sys_FadeState],a
ld a,e
ld [sys_FadeLevel],a
ret
; Must be run during VBlank, otherwise exits
UpdatePalettes:
ldh a,[hConsoleType]
cp SYSTEM_CGB
ret c ; return if not on CGB or AGB
ldh a,[rLCDC]
bit 7,a ; is LCD on?
jr z,.skiply
ldh a,[rLY]
cp 144
ret c
; bg palettes
.skiply
ld a,$80
ldh [rBCPS],a
ld hl,sys_BGPalTransferBuf
rept 2*32
ld a,[hl+]
ldh [rBCPD],a
endr
; obj palettes
ld a,$80
ldh [rOCPS],a
ld hl,sys_ObjPalTransferBuf
rept 2*32
ld a,[hl+]
ldh [rOCPD],a
endr
ret
UpdatePaletteSingle:
ld c,a
ldh a,[hConsoleType]
cp SYSTEM_CGB
ret c ; return if not on CGB or AGB
: ldh a,[rSTAT]
bit STATB_BUSY,a ; check for VBlank or HBlank
jr z,:- ; return if we're not in HBlank or VBlank
ld a,c
add a ; x2
add a ; x4
add a ; x8
or $80
ldh [rBCPS],a ; auto-increment + address specified by palette number C
ld hl,sys_PalTransferBuf
ld b,0
add hl,bc ; x2
add hl,bc ; x4
add hl,bc ; x8
ld c,low(rBCPD)
rept 2*4
ld a,[hl+]
ld [c],a
endr
ret
Pal_DoFade:
ld a,[sys_FadeState]
bit 0,a
ret z
bit 1,a
jr nz,.black
.white
bit 2,a
jr z,_PalFadeInWhite
jr _PalFadeOutWhite
.black
bit 2,a
jr z,_PalFadeInBlack
jr _PalFadeOutBlack
_FinishFade:
xor a
ld [sys_FadeState],a
jr UpdatePalsWhite ; doesn't matter which table we use here
_PalFadeInWhite:
ld a,[sys_FadeLevel]
dec a
ld [sys_FadeLevel],a
jr z,_FinishFade
call UpdatePalsWhite
jp SyncPalettes
_PalFadeOutWhite:
ld a,[sys_FadeLevel]
inc a
ld [sys_FadeLevel],a
cp 31
jr z,_FinishFade
call UpdatePalsWhite
jr SyncPalettes
_PalFadeInBlack:
ld a,[sys_FadeLevel]
dec a
ld [sys_FadeLevel],a
jr z,_FinishFade
call UpdatePalsBlack
jp SyncPalettes
_PalFadeOutBlack:
ld a,[sys_FadeLevel]
inc a
ld [sys_FadeLevel],a
cp 31
jr z,_FinishFade
call UpdatePalsBlack
jr SyncPalettes
UpdatePalsWhite:
call ConvertPals
ld b,(3*4)*16
ld hl,sys_PalBuffer
.loop
push hl
ld a,[sys_FadeLevel]
dec a
ld l,a
ld h,0
add hl,hl ; x2
add hl,hl ; x4
add hl,hl ; x8
add hl,hl ; x16
add hl,hl ; x32
ld d,h
ld e,l
ld hl,PalFadeWhiteTable
add hl,de
ld d,h
ld e,l
pop hl
ld a,[hl]
add e
ld e,a
jr nc,.nocarry
inc d
.nocarry
ld a,[de]
ld [hl+],a
dec b
jr nz,.loop
ret
UpdatePalsBlack:
call ConvertPals
ld b,(3*4)*16
ld hl,sys_PalBuffer
.loop
push hl
ld a,[sys_FadeLevel]
dec a
ld l,a
ld h,0
add hl,hl ; x2
add hl,hl ; x4
add hl,hl ; x8
add hl,hl ; x16
add hl,hl ; x32
ld d,h
ld e,l
ld hl,PalFadeBlackTable
add hl,de
ld d,h
ld e,l
pop hl
ld a,[hl]
add e
ld e,a
jr nc,.nocarry
inc d
.nocarry
ld a,[de]
ld [hl+],a
dec b
jr nz,.loop
ret
SyncPalettes:
ld hl,sys_PalBuffer
ld de,sys_PalTransferBuf
ld b,8*8
.syncloop
push bc
push hl
push de
ld a,[hl+]
ld e,a
ld a,[hl+]
ld b,a
ld a,[hl+]
ld c,a
ld a,e
call CombineColors
pop de
ld a,l
ld [de],a
inc e
ld a,h
ld [de],a
inc e
pop hl
inc hl
inc hl
inc hl
pop bc
dec b
jr nz,.syncloop
ret
; INPUT: a = palette number to load into (bit 3 for object palette)
; hl = palette pointer
; DESTROYS: a, b, de, hl
LoadPal:
push af
push af
xor a
ld [sys_FadeState],a
pop af
and 15
bit 3,a
jr nz,.obj
add a ; x2
add a ; x4
add a ; x8
ld b,a
ld de,sys_BGPalettes
add e
ld e,a
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
pop af
ret
.obj
sub 8
add a ; x2
add a ; x4
add a ; x8
ld b,a
ld de,sys_ObjPalettes
add e
ld e,a
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
ld a,[hl+]
ld [de],a
inc e
pop af
ret
AllPalsWhite:
ld hl,sys_PalTransferBuf
ld b,sys_PalBuffer-sys_PalTransferBuf
ld a,$ff
.loop
ld [hl+],a
xor %10000000
dec b
jr nz,.loop
ret
AllPalsBlack:
ld hl,sys_PalTransferBuf
ld b,sys_PalBuffer-sys_PalTransferBuf
xor a
.loop
ld [hl+],a
dec b
jr nz,.loop
ret
ConvertPals:
call CopyPalettes
ld hl,sys_PalTransferBuf
ld de,sys_PalBuffer
ld b,8*8
.loop
push bc
ld a,[hl+]
ld b,a
ld a,[hl+]
push hl
ld h,a
ld l,b
call SplitColors
ld [de],a
inc de
ld a,b
ld [de],a
inc de
ld a,c
ld [de],a
inc de
pop hl
pop bc
dec b
jr nz,.loop
ret
CopyPalettes:
ld hl,sys_Palettes
ld de,sys_PalTransferBuf
ld b,sys_PalBuffersEnd-sys_Palettes
jp Copy8
CopyPaletteSingle:
ld l,a
ld h,0
add hl,hl ; x2
add hl,hl ; x4
add hl,hl ; x8
ld b,h
ld c,l
ld hl,sys_PalTransferBuf
add hl,bc
ld d,h
ld e,l
ld hl,sys_Palettes
add hl,bc
ld b,8
jp Copy8
; Takes a palette color and splits it into its RGB components.
; INPUT: hl = color
; OUTPUT: a = red
; b = green
; c = blue
SplitColors:
push de
ld a,l ; GGGRRRRR
and %00011111 ; xxxRRRRR
ld e,a
ld a,l
and %11100000 ; GGGxxxxx
swap a ; xxxxGGGx
rra ; xxxxxGGG
ld b,a
ld a,h ; xBBBBBGG
and %00000011 ; xxxxxxGG
swap a ; xxGGxxxx
rra ; xxxGGxxx
or b ; xxxGGGGG
ld b,a
ld a,h ; xBBBBBGG
and %01111100 ; xBBBBBxx
rra ; xxBBBBBx
rra ; xxxBBBBB
ld c,a
ld a,e
pop de
ret
; Takes a set of RGB components and converts it to a palette color.
; INPUT: a = red
; b = green
; c = blue
; OUTPUT: hl = color
; DESTROYS: a
CombineColors:
ld l,a ; hl = ???????? xxxRRRRR
ld a,b ; a = xxxGGGGG
and %00000111 ; a = xxxxxGGG
swap a ; a = xGGGxxxx
rla ; a = GGGxxxxx
or l ; a = GGGRRRRR
ld l,a ; hl = ???????? GGGRRRRR
ld a,b ; a = xxxGGGGG
and %00011000 ; a = xxxGGxxx
rla ; a = xxGGxxxx
swap a ; a = xxxxxxGG
ld h,a ; hl = xxxxxxGG GGGRRRRR
ld a,c ; a = xxxBBBBB
rla ; a = xxBBBBBx
rla ; a = xBBBBBxx
or h ; a = xBBBBBGG
ld h,a ; hl = xBBBBBGG GGGRRRRR
ret
PalFadeBlackTable:
db 0, 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
db 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30
db 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,22,23,24,25,26,27,28,29
db 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9,10,11,12,13,14,14,15,16,17,18,19,20,21,22,23,23,24,25,26,27,28
db 0, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9,10,10,11,12,13,14,15,16,17,17,18,19,20,21,22,23,24,24,25,26,27
db 0, 1, 2, 3, 3, 4, 5, 6, 7, 8, 8, 9,10,11,12,13,13,14,15,16,17,18,18,19,20,21,22,23,23,24,25,26
db 0, 1, 2, 2, 3, 4, 5, 6, 6, 7, 8, 9,10,10,11,12,13,14,15,15,16,17,18,19,19,20,21,22,23,23,24,25
db 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9,10,11,12,12,13,14,15,15,16,17,18,19,19,20,21,22,22,23,24
db 0, 1, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9,10,10,11,12,13,13,14,15,16,16,17,18,19,19,20,21,22,22,23
db 0, 1, 1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9,10,11,11,12,13,13,14,15,16,16,17,18,18,19,20,21,21,22
db 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9,10,11,12,12,13,14,14,15,16,16,17,18,18,19,20,20,21
db 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 8, 8, 9,10,10,11,12,12,13,14,14,15,15,16,17,17,18,19,19,20
db 0, 1, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9,10,10,11,12,12,13,13,14,15,15,16,17,17,18,18,19
db 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9,10,10,11,12,12,13,13,14,15,15,16,16,17,17,18
db 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9,10,10,11,12,12,13,13,14,14,15,15,16,16,17
db 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16
db 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15
db 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9,10,10,11,11,12,12,13,13,14,14
db 0, 0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9,10,10,10,11,11,12,12,13,13
db 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9,10,10,10,11,11,12,12
db 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9,10,10,10,11,11
db 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9,10,10
db 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9
db 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8
db 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7
db 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6
db 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5
db 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4
db 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3
db 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
PalFadeWhiteTable:
db 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,31
db 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,31
db 3, 4, 5, 6, 7, 8, 9,10,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,25,26,27,28,29,30,31,31
db 4, 5, 6, 7, 8, 9, 9,10,11,12,13,14,15,16,17,18,18,19,20,21,22,23,24,25,26,27,27,28,29,30,31,31
db 5, 6, 7, 8, 8, 9,10,11,12,13,14,15,15,16,17,18,19,20,21,22,22,23,24,25,26,27,28,29,29,30,31,31
db 6, 7, 8, 9, 9,10,11,12,13,14,14,15,16,17,18,19,19,20,21,22,23,24,24,25,26,27,28,29,29,30,31,31
db 7, 8, 9, 9,10,11,12,13,13,14,15,16,17,17,18,19,20,21,22,22,23,24,25,26,26,27,28,29,30,30,31,31
db 8, 9,10,10,11,12,13,13,14,15,16,17,17,18,19,20,20,21,22,23,23,24,25,26,27,27,28,29,30,30,31,31
db 9,10,10,11,12,13,13,14,15,16,16,17,18,19,19,20,21,22,22,23,24,25,25,26,27,28,28,29,30,31,31,31
db 10,11,11,12,13,14,14,15,16,16,17,18,19,19,20,21,21,22,23,23,24,25,26,26,27,28,28,29,30,31,31,31
db 11,12,12,13,14,14,15,16,16,17,18,18,19,20,20,21,22,23,23,24,25,25,26,27,27,28,29,29,30,31,31,31
db 12,13,13,14,15,15,16,17,17,18,18,19,20,20,21,22,22,23,24,24,25,26,26,27,27,28,29,29,30,31,31,31
db 13,14,14,15,15,16,17,17,18,19,19,20,20,21,22,22,23,23,24,25,25,26,26,27,28,28,29,30,30,31,31,31
db 14,15,15,16,16,17,17,18,19,19,20,20,21,22,22,23,23,24,24,25,26,26,27,27,28,29,29,30,30,31,31,31
db 15,16,16,17,17,18,18,19,19,20,20,21,22,22,23,23,24,24,25,25,26,27,27,28,28,29,29,30,30,31,31,31
db 16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,31
db 17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,31,31
db 18,18,19,19,20,20,21,21,22,22,23,23,23,24,24,25,25,26,26,27,27,27,28,28,29,29,30,30,31,31,31,31
db 19,19,20,20,21,21,22,22,22,23,23,24,24,24,25,25,26,26,27,27,27,28,28,29,29,29,30,30,31,31,31,31
db 20,20,21,21,22,22,22,23,23,23,24,24,25,25,25,26,26,27,27,27,28,28,29,29,29,30,30,30,31,31,31,31
db 21,21,22,22,22,23,23,23,24,24,25,25,25,26,26,26,27,27,27,28,28,28,29,29,30,30,30,31,31,31,31,31
db 22,22,23,23,23,24,24,24,25,25,25,26,26,26,27,27,27,27,28,28,28,29,29,29,30,30,30,31,31,31,31,31
db 23,23,24,24,24,24,25,25,25,26,26,26,26,27,27,27,28,28,28,29,29,29,29,30,30,30,31,31,31,31,31,31
db 24,24,25,25,25,25,26,26,26,26,27,27,27,27,28,28,28,28,29,29,29,29,30,30,30,30,31,31,31,31,31,31
db 25,25,25,26,26,26,26,27,27,27,27,27,28,28,28,28,29,29,29,29,30,30,30,30,30,31,31,31,31,31,31,31
db 26,26,26,27,27,27,27,27,28,28,28,28,28,29,29,29,29,29,29,30,30,30,30,30,31,31,31,31,31,31,31,31
db 27,27,27,27,28,28,28,28,28,28,29,29,29,29,29,29,30,30,30,30,30,30,31,31,31,31,31,31,31,31,31,31
db 28,28,28,28,29,29,29,29,29,29,29,29,30,30,30,30,30,30,30,30,31,31,31,31,31,31,31,31,31,31,31,31
db 29,29,29,29,29,29,30,30,30,30,30,30,30,30,30,30,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
db 30,30,30,30,30,30,30,30,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
db 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31