3 open TABLE, ">", "table/linedraw.h";
10 # 0..8 (equally spaced) 9,11 mid-1,mid+1, makes 4 bit
11 # one point = 8 bit, two points = 16 bit
13 # 8 bit opcode 0 line, 1 rect, 2 arc
16 # OOOOOOOO AAAABBBB X1X1Y1Y1 X2X2Y2Y2
22 my ($code, $x1, $y1, $x2, $y2, $a, $b) = @_;
24 printf " 0x%08lx,", ($code << 24)
33 print "static uint32_t linedraw_command[] = {\n";
41 my ($v, $V, $h, $H, $s);
47 /\G([123])/gc and $w = $1;
54 /\G\//gc and emit 0, 0, 8, 8, 0;
55 /\G\\/gc and emit 0, 0, 0, 8, 8;
57 /\GA/gc and emit 2, 8, 8, 0, 0, 2, 2;
58 /\GB/gc and emit 2, 0, 8, 0, 0, 1, 2;
59 /\GC/gc and emit 2, 0, 0, 0, 0, 1, 0;
60 /\GD/gc and emit 2, 8, 0, 0, 0, 0, 0;
62 /\Gi/gc and emit 1, 0, 0, 4, 4;
63 /\Gj/gc and emit 1, 4, 0, 8, 4;
64 /\Gk/gc and emit 1, 0, 4, 4, 8;
65 /\Gl/gc and emit 1, 4, 4, 8, 8;
67 /\Gs(\d)/gc and $s = $1;
69 /\Gr(\d+),(\d+),(\d+),(\d+)/gc and emit 1, $1, $2, $3, $4, $s;
75 emit 0, 0, 9,10, 9 if $h > 1;
76 emit 0, 0, 10,10, 10 if $h & 1;
77 emit 0, 0, 11,10, 11 if $h > 1;
81 emit 0,10, 9, 8, 9 if $H > 1;
82 emit 0,10, 10, 8, 10 if $H & 1;
83 emit 0,10, 11, 8, 11 if $H > 1;
87 emit 0, 9, 0, 9, 10 if $v > 1;
88 emit 0,10, 0,10, 10 if $v & 1;
89 emit 0,11, 0,11, 10 if $v > 1;
93 emit 0, 9, 10, 9, 8 if $V > 1;
94 emit 0,10, 10,10, 8 if $V & 1;
95 emit 0,11, 10,11, 8 if $V > 1;
98 $offs[-1] = ($offs[-1] << 4) | ($offs - $offs[-1]);
100 printf " // %04x\n", $ch;
107 static uint16_t linedraw_offs[] = {
111 printf " 0x%04x,", $_;
112 print "\n" if ++$cnt % 5 == 0;
128 r0,10,1,10 r3,10,5,10 r7,10,8,10
129 r0,9,1,11 r3,9,5,11 r7,9,8,11
130 r10,0,10,1 r10,3,10,5 r10,7,10,8
131 r9,0,11,1 r9,3,11,5 r9,7,11,8
133 r0,10,1,10 r2,10,3,10 r4,10,5,10 r6,10,7,10
134 r0,9,1,11 r2,9,3,11 r4,9,5,11 r6,9,7,11
135 r10,0,10,1 r10,2,10,3 r10,4,10,5 r10,6,10,7
136 r9,0,11,1 r9,2,11,3 r9,4,11,5 r9,6,11,7
230 r0,10,3,10 r5,10,8,10
232 r10,0,10,3 r10,5,10,8