Skip to content

Commit 4fa77c1

Browse files
xmas tree
1 parent c213718 commit 4fa77c1

File tree

2 files changed

+141
-45
lines changed

2 files changed

+141
-45
lines changed

demos/generic_multiplexer/many_flakes2_test.c

Lines changed: 110 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,36 @@ const unsigned char STAR_0[4] = {0x00,0x10,0x10,0x00};
111111
const unsigned char STAR_1[4] = {0x10,0x28,0x38,0x10};
112112
// const star STAR_0[4] = {};
113113

114+
/*
115+
0 $00 black
116+
1 $01 white
117+
2 $02 red
118+
3 $03 cyan
119+
4 $04 purple
120+
5 $05 green
121+
6 $06 blue
122+
7 $07 yellow
123+
8 $08 orange
124+
9 $09 brown
125+
10 $0A pink
126+
11 $0B dark grey
127+
12 $0C grey
128+
13 $0D light green
129+
14 $0E light blue
130+
15 $0F light grey
131+
132+
*/
133+
#define WHITE 0x01
134+
#define RED 0x02
135+
#define CYAN 0x03
136+
#define PURPLE 0x04
137+
#define GREEN 0x05
138+
#define YELLOW 0x07
139+
#define BROWN 0x09
140+
#define PINK 0x0A
141+
#define LIGHT_BLUE 0x0E
142+
#define LIGHT_GREY 0x0F
143+
114144
#define X_OFFSET 46
115145
#define Y_OFFSET 58
116146

@@ -132,7 +162,7 @@ static unsigned char j;
132162
static unsigned char h;
133163
static unsigned char restored_text_row[35];
134164

135-
#define COMET_X 0
165+
#define COMET_X 4
136166
#define COMET_Y 23
137167

138168
unsigned char XX = 0;
@@ -182,6 +212,23 @@ unsigned char text_counter = 0;
182212
unsigned char XB;
183213
unsigned cycle = 1;
184214

215+
216+
#define TILE_BASE ('9'+31)
217+
218+
#define NUMBER_OF_COLUMNS 40
219+
#define TREE_LEVEL(n) ((24-n)*(NUMBER_OF_COLUMNS))
220+
221+
#define MULTI_CHAR_COLOR_1 0xD022
222+
#define MULTI_CHAR_COLOR_2 0xD023
223+
224+
#define MULTI_COLOR_BIT 8
225+
226+
#define XTREE_LIGHT_1 (COLOR+TREE_LEVEL(3)+1)
227+
#define XTREE_LIGHT_2 (COLOR+TREE_LEVEL(2)+1)
228+
#define XTREE_LIGHT_3 (COLOR+TREE_LEVEL(2)+2)
229+
#define XTREE_LIGHT_4 (COLOR+TREE_LEVEL(1)+1)
230+
#define XTREE_LIGHT_5 (COLOR+TREE_LEVEL(1)+2)
231+
185232
// $D018 = 53272
186233
// -----------------
187234
void init_udg(void)
@@ -230,6 +277,14 @@ void color_change(void)
230277
POKE(COLOR+26+h,TEXT_COLOR_OFFSET+color);
231278
POKE(COLOR+40+26+h,TEXT_COLOR_OFFSET+color);
232279
}
280+
281+
282+
POKE(XTREE_LIGHT_1,MULTI_COLOR_BIT+RED+(j&3));
283+
POKE(XTREE_LIGHT_2,MULTI_COLOR_BIT+RED+((j+1)&3));
284+
POKE(XTREE_LIGHT_3,MULTI_COLOR_BIT+RED+((j+2)&3));
285+
POKE(XTREE_LIGHT_4,MULTI_COLOR_BIT+RED+((j+3)&3));
286+
POKE(XTREE_LIGHT_5,MULTI_COLOR_BIT+RED+((j)&3));
287+
233288
}
234289

235290

@@ -310,35 +365,7 @@ void restore_text_row(void)
310365
#define RIGHT_BIG_SNOW_INDEX (NUMSPRITES-1)
311366
#define LEFT_BIG_SNOW_INDEX (NUMSPRITES-3)
312367

313-
/*
314-
0 $00 black
315-
1 $01 white
316-
2 $02 red
317-
3 $03 cyan
318-
4 $04 purple
319-
5 $05 green
320-
6 $06 blue
321-
7 $07 yellow
322-
8 $08 orange
323-
9 $09 brown
324-
10 $0A pink
325-
11 $0B dark grey
326-
12 $0C grey
327-
13 $0D light green
328-
14 $0E light blue
329-
15 $0F light grey
330368

331-
*/
332-
#define WHITE 0x01
333-
#define RED 0x02
334-
#define CYAN 0x03
335-
#define PURPLE 0x04
336-
#define GREEN 0x05
337-
#define YELLOW 0x07
338-
#define BROWN 0x09
339-
#define PINK 0x0A
340-
#define LIGHT_BLUE 0x0E
341-
#define LIGHT_GREY 0x0F
342369

343370
void draw_top_text(void)
344371
{
@@ -516,6 +543,56 @@ void clear_screen(void)
516543
}
517544
}
518545

546+
547+
void draw_xmas_tree(void)
548+
{
549+
550+
POKE(MULTI_CHAR_COLOR_1,YELLOW);
551+
POKE(MULTI_CHAR_COLOR_2,GREEN);
552+
553+
554+
POKE(SCREEN+TREE_LEVEL(3)+1,TILE_BASE);
555+
POKE(SCREEN+TREE_LEVEL(3)+2,TILE_BASE+1);
556+
557+
POKE(SCREEN+TREE_LEVEL(2), TILE_BASE+2);
558+
POKE(SCREEN+TREE_LEVEL(2)+1,TILE_BASE+3);
559+
POKE(SCREEN+TREE_LEVEL(2)+2,TILE_BASE+4);
560+
POKE(SCREEN+TREE_LEVEL(2)+3,TILE_BASE+5);
561+
562+
POKE(SCREEN+TREE_LEVEL(1), TILE_BASE+6);
563+
POKE(SCREEN+TREE_LEVEL(1)+1,TILE_BASE+7);
564+
POKE(SCREEN+TREE_LEVEL(1)+2,TILE_BASE+8);
565+
POKE(SCREEN+TREE_LEVEL(1)+3,TILE_BASE+9);
566+
567+
POKE(SCREEN+TREE_LEVEL(0), TILE_BASE+10);
568+
POKE(SCREEN+TREE_LEVEL(0)+1,TILE_BASE+11);
569+
POKE(SCREEN+TREE_LEVEL(0)+2,TILE_BASE+12);
570+
POKE(SCREEN+TREE_LEVEL(0)+3,TILE_BASE+13);
571+
572+
573+
POKE(COLOR+TREE_LEVEL(3)+1,RED+MULTI_COLOR_BIT);
574+
POKE(COLOR+TREE_LEVEL(3)+2,YELLOW+MULTI_COLOR_BIT);
575+
576+
POKE(COLOR+TREE_LEVEL(2), 3+MULTI_COLOR_BIT);
577+
POKE(COLOR+TREE_LEVEL(2)+1,YELLOW+MULTI_COLOR_BIT);
578+
POKE(COLOR+TREE_LEVEL(2)+2,RED+MULTI_COLOR_BIT);
579+
POKE(COLOR+TREE_LEVEL(2)+3,3+MULTI_COLOR_BIT);
580+
581+
POKE(COLOR+TREE_LEVEL(1), 4+MULTI_COLOR_BIT);
582+
POKE(COLOR+TREE_LEVEL(1)+1,RED+MULTI_COLOR_BIT);
583+
POKE(COLOR+TREE_LEVEL(1)+2,YELLOW+MULTI_COLOR_BIT);
584+
POKE(COLOR+TREE_LEVEL(1)+3,4+MULTI_COLOR_BIT);
585+
586+
POKE(COLOR+TREE_LEVEL(0), GREEN+MULTI_COLOR_BIT);
587+
POKE(COLOR+TREE_LEVEL(0)+1,RED);
588+
POKE(COLOR+TREE_LEVEL(0)+2,RED);
589+
POKE(COLOR+TREE_LEVEL(0)+3,GREEN+MULTI_COLOR_BIT);
590+
591+
// while(1)
592+
// {}
593+
}
594+
595+
519596
void init_background(void)
520597
{
521598
clear_screen();
@@ -535,6 +612,8 @@ void init_background(void)
535612

536613
draw_the_moon();
537614

615+
draw_xmas_tree();
616+
538617
}
539618

540619
void handle_slow_comets(void)
@@ -556,7 +635,7 @@ void handle_slow_comets(void)
556635
{
557636
do
558637
{
559-
slow_comet_1_x_start = COMET_X+(rand()&31);
638+
slow_comet_1_x_start = COMET_X+(rand()&15);
560639
}
561640
#if SLOW_COMETS==2
562641
while((slow_comet_1_x_start==slow_comet_2_x_start)||(slow_comet_1_x_start==fast_comet_1_x_start)||(slow_comet_1_x_start==fast_comet_2_x_start));
@@ -792,7 +871,7 @@ void init_happy_new_year_sprites(void)
792871
// SPRX[i+8]=10+i*XMAS_FONT_SPACING;
793872
// }
794873

795-
874+
// draw_xmas_tree();
796875
}
797876

798877

graphics/snow_flakes_udg2.s

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
.byte $fc,$c0,$fc,$06,$06,$c6,$7c,$00,$3c,$60,$c0,$fc,$c6,$c6,$7c,$00
5757
.byte $fe,$c6,$0c,$18,$30,$30,$30,$00,$78,$c4,$e4,$78,$9e,$86,$7c,$00
5858
.byte $7c,$c6,$c6,$7e,$06,$0c,$78,$00 ; 9
59+
60+
; happy new year big text
61+
5962
.byte $00,$00,$03,$03,$07,$07,$0e,$0e
6063
.byte $00,$00,$c0,$c0,$e0,$e0,$70,$70
6164
.byte $1c,$1f,$3f,$38,$78,$70,$f0,$00
@@ -86,20 +89,34 @@
8689
.byte $00,$00,$1e,$3c,$78,$f0,$e0,$c0
8790
.byte $80,$c0,$e0,$f0,$78,$3c,$1e,$00
8891
.byte $00,$00,$78,$3c,$1e,$0f,$07,$03
89-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
90-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
91-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
92-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
93-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
94-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
95-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
96-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
97-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
98-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
99-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
100-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
101-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
102-
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
92+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
93+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
94+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
95+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
96+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
97+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
98+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
99+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
100+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
101+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
102+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
103+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
104+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
105+
; .BYTE $00,$00,$00,$00,$00,$00,$00,$00
106+
107+
; xmas tree ('9'+31)
108+
.byte $01,$04,$01,$02,$0A,$2A,$AB,$8B
109+
.byte $00,$40,$00,$00,$80,$A0,$A8,$88
110+
111+
.byte $00,$00,$00,$00,$00,$02,$0A,$08,$0A,$0A,$2A,$2E,$AE,$AA,$AA,$0A
112+
.byte $80,$80,$A0,$A0,$E8,$EA,$AA,$80,$00,$00,$00,$00,$00,$00,$80,$80
113+
114+
.byte $00,$00,$00,$00,$00,$02,$0A,$2A,$0A,$2B,$2B,$AA,$AA,$AA,$AA,$AA
115+
.byte $80,$A0,$A0,$A8,$BA,$BA,$AA,$AA,$00,$00,$00,$00,$00,$00,$80,$A0
116+
117+
.byte $20,$00,$00,$00,$00,$00,$00,$00,$03,$03,$03,$03,$03,$03,$03,$03
118+
.byte $00,$00,$00,$00,$00,$00,$00,$00,$20,$00,$00,$00,$00,$00,$00,$00
119+
103120
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
104121
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
105122
.BYTE $00,$00,$00,$00,$00,$00,$00,$00

0 commit comments

Comments
 (0)