1 |
2 |
marcelos |
/*
|
2 |
|
|
* Copyright (c) 2018, Marcelo Samsoniuk
|
3 |
|
|
* All rights reserved.
|
4 |
|
|
*
|
5 |
|
|
* Redistribution and use in source and binary forms, with or without
|
6 |
|
|
* modification, are permitted provided that the following conditions are met:
|
7 |
|
|
*
|
8 |
|
|
* * Redistributions of source code must retain the above copyright notice, this
|
9 |
|
|
* list of conditions and the following disclaimer.
|
10 |
|
|
*
|
11 |
|
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
12 |
|
|
* this list of conditions and the following disclaimer in the documentation
|
13 |
|
|
* and/or other materials provided with the distribution.
|
14 |
|
|
*
|
15 |
|
|
* * Neither the name of the copyright holder nor the names of its
|
16 |
|
|
* contributors may be used to endorse or promote products derived from
|
17 |
|
|
* this software without specific prior written permission.
|
18 |
|
|
*
|
19 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20 |
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
22 |
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
23 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
25 |
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
26 |
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
27 |
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28 |
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29 |
|
|
*/
|
30 |
|
|
|
31 |
|
|
#define RLE 1
|
32 |
|
|
|
33 |
|
|
#include <stdio.h>
|
34 |
|
|
|
35 |
|
|
void banner(void)
|
36 |
|
|
{
|
37 |
|
|
#ifndef RLE
|
38 |
|
|
|
39 |
|
|
// https://github.com/riscv/riscv-pk/blob/master/bbl/riscv_logo.txt
|
40 |
|
|
// https://github.com/riscv/riscv-pk/blob/master/LICENSE.riscv_logo.txt
|
41 |
|
|
// Copyright (C) 2015 Andrew Waterman
|
42 |
|
|
|
43 |
|
|
char *logo =
|
44 |
|
|
|
45 |
|
|
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n"
|
46 |
|
|
" vvvvvvvvvvvvvvvvvvvvvvvvvvvv\n"
|
47 |
|
|
"rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvvvv\n"
|
48 |
|
|
"rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv\n"
|
49 |
|
|
"rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv\n"
|
50 |
|
|
"rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv\n"
|
51 |
|
|
"rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv\n"
|
52 |
|
|
"rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv \n"
|
53 |
|
|
"rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv \n"
|
54 |
|
|
"rr vvvvvvvvvvvvvvvvvvvvvv \n"
|
55 |
|
|
"rr vvvvvvvvvvvvvvvvvvvvvvvv rr\n"
|
56 |
|
|
"rrrr vvvvvvvvvvvvvvvvvvvvvvvvvv rrrr\n"
|
57 |
|
|
"rrrrrr vvvvvvvvvvvvvvvvvvvvvv rrrrrr\n"
|
58 |
|
|
"rrrrrrrr vvvvvvvvvvvvvvvvvv rrrrrrrr\n"
|
59 |
|
|
"rrrrrrrrrr vvvvvvvvvvvvvv rrrrrrrrrr\n"
|
60 |
|
|
"rrrrrrrrrrrr vvvvvvvvvv rrrrrrrrrrrr\n"
|
61 |
|
|
"rrrrrrrrrrrrrr vvvvvv rrrrrrrrrrrrrr\n"
|
62 |
|
|
"rrrrrrrrrrrrrrrr vv rrrrrrrrrrrrrrrr\n"
|
63 |
|
|
"rrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrr\n"
|
64 |
|
|
"rrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr\n"
|
65 |
|
|
"rrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrr\n"
|
66 |
|
|
"\n"
|
67 |
|
|
" INSTRUCTION SETS WANT TO BE FREE\n\n";
|
68 |
|
|
|
69 |
|
|
// rle compressor: 1030 to 269 bytes! +_+
|
70 |
|
|
|
71 |
|
|
register int xc=0,xs=0,xp;
|
72 |
|
|
|
73 |
|
|
printf(" char rle_logo[] = {\n");
|
74 |
|
|
|
75 |
|
|
for(xp=0;;xp++)
|
76 |
|
|
{
|
77 |
|
|
if(xc!=logo[xp])
|
78 |
|
|
{
|
79 |
|
|
if(xc)
|
80 |
|
|
{
|
81 |
|
|
printf("0x%x, 0x%x, ",xc,xs);
|
82 |
|
|
}
|
83 |
|
|
xs=1;
|
84 |
|
|
if(!(xc=logo[xp])) break;
|
85 |
|
|
}
|
86 |
|
|
else xs++;
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
printf("0x00 };\n");
|
90 |
|
|
|
91 |
|
|
#else
|
92 |
|
|
|
93 |
|
|
char rle_logo[] = {
|
94 |
|
|
0x20, 0x0e, 0x76, 0x20, 0x0a, 0x01, 0x20, 0x12, 0x76, 0x1c, 0x0a,
|
95 |
|
|
0x01, 0x72, 0x0d, 0x20, 0x07, 0x76, 0x1a, 0x0a, 0x01, 0x72, 0x10,
|
96 |
|
|
0x20, 0x06, 0x76, 0x18, 0x0a, 0x01, 0x72, 0x12, 0x20, 0x04, 0x76,
|
97 |
|
|
0x18, 0x0a, 0x01, 0x72, 0x12, 0x20, 0x04, 0x76, 0x18, 0x0a, 0x01,
|
98 |
|
|
0x72, 0x12, 0x20, 0x04, 0x76, 0x18, 0x0a, 0x01, 0x72, 0x10, 0x20,
|
99 |
|
|
0x06, 0x76, 0x16, 0x20, 0x02, 0x0a, 0x01, 0x72, 0x0d, 0x20, 0x07,
|
100 |
|
|
0x76, 0x16, 0x20, 0x04, 0x0a, 0x01, 0x72, 0x02, 0x20, 0x10, 0x76,
|
101 |
|
|
0x16, 0x20, 0x06, 0x0a, 0x01, 0x72, 0x02, 0x20, 0x0c, 0x76, 0x18,
|
102 |
|
|
0x20, 0x06, 0x72, 0x02, 0x0a, 0x01, 0x72, 0x04, 0x20, 0x06, 0x76,
|
103 |
|
|
0x1a, 0x20, 0x06, 0x72, 0x04, 0x0a, 0x01, 0x72, 0x06, 0x20, 0x06,
|
104 |
|
|
0x76, 0x16, 0x20, 0x06, 0x72, 0x06, 0x0a, 0x01, 0x72, 0x08, 0x20,
|
105 |
|
|
0x06, 0x76, 0x12, 0x20, 0x06, 0x72, 0x08, 0x0a, 0x01, 0x72, 0x0a,
|
106 |
|
|
0x20, 0x06, 0x76, 0x0e, 0x20, 0x06, 0x72, 0x0a, 0x0a, 0x01, 0x72,
|
107 |
|
|
0x0c, 0x20, 0x06, 0x76, 0x0a, 0x20, 0x06, 0x72, 0x0c, 0x0a, 0x01,
|
108 |
|
|
0x72, 0x0e, 0x20, 0x06, 0x76, 0x06, 0x20, 0x06, 0x72, 0x0e, 0x0a,
|
109 |
|
|
0x01, 0x72, 0x10, 0x20, 0x06, 0x76, 0x02, 0x20, 0x06, 0x72, 0x10,
|
110 |
|
|
0x0a, 0x01, 0x72, 0x12, 0x20, 0x0a, 0x72, 0x12, 0x0a, 0x01, 0x72,
|
111 |
|
|
0x14, 0x20, 0x06, 0x72, 0x14, 0x0a, 0x01, 0x72, 0x16, 0x20, 0x02,
|
112 |
|
|
0x72, 0x16, 0x0a, 0x02, 0x20, 0x07, 0x49, 0x01, 0x4e, 0x01, 0x53,
|
113 |
|
|
0x01, 0x54, 0x01, 0x52, 0x01, 0x55, 0x01, 0x43, 0x01, 0x54, 0x01,
|
114 |
|
|
0x49, 0x01, 0x4f, 0x01, 0x4e, 0x01, 0x20, 0x01, 0x53, 0x01, 0x45,
|
115 |
|
|
0x01, 0x54, 0x01, 0x53, 0x01, 0x20, 0x01, 0x57, 0x01, 0x41, 0x01,
|
116 |
|
|
0x4e, 0x01, 0x54, 0x01, 0x20, 0x01, 0x54, 0x01, 0x4f, 0x01, 0x20,
|
117 |
|
|
0x01, 0x42, 0x01, 0x45, 0x01, 0x20, 0x01, 0x46, 0x01, 0x52, 0x01,
|
118 |
|
|
0x45, 0x02, 0x0a, 0x02, 0x00 };
|
119 |
|
|
|
120 |
|
|
//printf("\33[H\33[2J");
|
121 |
|
|
putchar('\n');
|
122 |
|
|
|
123 |
|
|
register int c,s;
|
124 |
|
|
register char *p = rle_logo;
|
125 |
|
|
|
126 |
|
|
while(*p)
|
127 |
|
|
{
|
128 |
|
|
c = *p++;
|
129 |
|
|
s = *p++;
|
130 |
|
|
|
131 |
|
|
while(s--) putchar(c);
|
132 |
|
|
}
|
133 |
|
|
|
134 |
|
|
#endif
|
135 |
|
|
}
|