source: buchla-68k/orig/BUCHLA/SHOWCG.C@ 5f1d169

Last change on this file since 5f1d169 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
File size: 2.2 KB
RevLine 
[3ae31e9]1/*
2 =============================================================================
3 showcg.c -- show the contents of a VSDD character generator table
4 Version 10 -- 1988-01-26 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "stdio.h"
9#include "stddefs.h"
10
11#define NPIXELS 8
12
13#define NCHARS 0xE0
14
15#include "cg2.c"
16
17int bitmask[] = {
18
19 0x0001, 0x0002, 0x0004, 0x0008,
20 0x0010, 0x0020, 0x0040, 0x0080,
21 0x0100, 0x0200, 0x0400, 0x0800,
22 0x1000, 0x2000, 0x4000, 0x8000
23};
24
25/*
26 */
27
28/*
29 =============================================================================
30 bitrev(bitsin, nbits) -- reverse the rightmost nbits of bitsin.
31
32 Any bits to the left of the reversed bits in the result will be zeros.
33 =============================================================================
34*/
35
36int
37bitrev(bitsin, nbits)
38register int bitsin, nbits;
39{
40 register int n, m;
41
42 n = 0;
43
44 for (m = 0; m < nbits; m++)
45 if (bitsin & bitmask[m])
46 n |= bitmask[nbits-1-m];
47
48 return(n);
49}
50
51/*
52 */
53
54/*
55 =============================================================================
56 pbits(row, bits) -- print the bits in a row of a character
57 =============================================================================
58*/
59
60pbits(row, bits)
61register int row, bits;
62{
63 register int j, k;
64
65 k = bits;
66
67 for (j = 0; j < NPIXELS; j++) {
68
69 if (bits & 1)
70 putchar('*');
71 else
72 putchar(' ');
73
74 bits = bits >> 1;
75 }
76
77 bits = bitrev(k, NPIXELS);
78
79 printf(" %1x %02x ", row, bits);
80}
81
82/*
83 */
84
85main()
86{
87 register int ch, irow, ich;
88
89 for (ch = 0; ch < NCHARS; ch += 4) {
90
91 printf("\n\n\t");
92
93 for (ich = 0; ich < 4; ich++)
94 printf("Ch %03d/%02x/%03o ", ch+ich, ch+ich, ch+ich);
95
96 printf("\n\t");
97
98 for (ich = 0; ich < 4; ich++)
99 printf("76543210 DA ");
100
101 printf("\n");
102
103 for (irow = cg_rows - 1; irow GE 0; irow--) {
104
105 printf("\t");
106 pbits(irow, cgtable[irow][ch]);
107 pbits(irow, cgtable[irow][ch+1]);
108 pbits(irow, cgtable[irow][ch+2]);
109 pbits(irow, cgtable[irow][ch+3]);
110 printf("\n");
111 }
112
113 if ((ch & 0x0F) EQ 12)
114 printf("\f");
115 }
116}
Note: See TracBrowser for help on using the repository browser.