summaryrefslogtreecommitdiffstats
path: root/data/ramdac.pl
blob: 72cc000f8c6bfddd4604cc0a99f5aa9553400dc1 (plain)
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
#!/usr/bin/perl
print "DEPTH = 512;\n";
print "WIDTH = 16;\n";
print "ADDRESS_RADIX = HEX;\n";
print "DATA_RADIX    = HEX;\n";
print "CONTENT\n";
print "BEGIN\n";

$x = 0;
for ($c = 0; $c < 2; $c++) {
    # Primary components, including flash
    for ($b = 0; $b < 8; $b++) {
	for ($f = 0; $f < 8; $f++) {
	    $v = $c ? $b : $f;
	    printf "%03X : %X%X%X;\n",
		$x++,
	        ($v & 4) ? 0xf : 0,
	        ($v & 2) ? 0xf : 0,
	        ($v & 1) ? 0xf : 0;
	}
    }

    # 6x6x5 color cube
    for ($r = 0; $r < 6; $r++) {
	for ($g = 0; $g < 6; $g++) {
	    for ($b = 0; $b < 5; $b++) {
		printf "%03X : %X%X%X;\n",
		    $x++, $r*3, $g*3, int($b*3.75+0.5);
	    }
	}
    }

    # Grey shades
    for ($g = 2; $g <= 13; $g++) {
	printf "%03X : %X%X%X;\n",
	    $x++, $g, $g, $g;
    }
}
print "END;";