-
Notifications
You must be signed in to change notification settings - Fork 0
/
blt.c
124 lines (119 loc) · 2.45 KB
/
blt.c
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*----------------------------------------------------------------------
*
* PACMAN for BBN BitGraphs
*
* File: blt.c
* Contents: block transfer routines
* Author: Bob Brown (rlb)
* Description: see below, customized for pacman
*
* Copyright (c) 1987 Robert L. Brown. All Rights Reserved. This code
* is public domain.
*
*---------------------------------------------------------------------
*/
#include "style.h"
#include "pacman.h"
#include "bithdwr.h"
/*
* block transfer routines - customized for pacman
*
* blt24 - copies a 24x24 font character to the screen
* blt40 - copies a 40x40 font character to the screen
*
* opcode:
* REPLACE ... replace mode
* PAINT ..... or in
* INVERT .... xor in
*/
blt24(chr, row, col, opcode)
char chr;
int row,col;
int opcode;
{
register unsigned char *mem, *form;
register unsigned char *formend;
#if V1_25
mem = SCtoMEM(row-1,col+1);
#else
mem = SCtoMEM(row+1,col-1);
#endif
form = chr24[chr-'a'];
formend = form+FONTSIZE*FONTSIZE/BYTESIZE;
switch ( opcode ) {
case REPLACE:
while ( form < formend ) {
*(mem) = *(form);
*(mem+1) = *(form+1);
*(mem+2) = *(form+2);
mem += RASTROWLEN;
form += FONTSIZE/BYTESIZE;
}
break;
case INVERT:
while ( form < formend ) {
*(mem) ^= *(form);
*(mem+1) ^= *(form+1);
*(mem+2) ^= *(form+2);
mem += RASTROWLEN;
form += FONTSIZE/BYTESIZE;
}
break;
}
}
/*
* Forty-bit font blt.
*/
blt40(chr, row, col, opcode)
char chr;
int row,col;
int opcode;
{
register unsigned char *mem, *form;
register unsigned char *formend;
register int i;
#if V1_25
mem = SCtoMEM(row-2,col+2);
#else
mem = SCtoMEM(row+2,col-2);
#endif
form = chr40[chr-'a'];
formend = form+BIGFONT*BIGFONT/BYTESIZE;
switch ( opcode ) {
/*
case REPLACE:
while ( form < formend ) {
*(mem) = *(form);
*(mem+1) = *(form+1);
*(mem+2) = *(form+2);
*(mem+3) = *(form+3);
*(mem+4) = *(form+4);
mem += RASTROWLEN;
form += BIGFONT/BYTESIZE;
}
break;
case PAINT:
while ( form < formend ) {
*(mem) |= *(form);
*(mem+1) |= *(form+1);
*(mem+2) |= *(form+2);
*(mem+3) |= *(form+3);
*(mem+4) |= *(form+4);
mem += RASTROWLEN;
form += BIGFONT/BYTESIZE;
}
break;
*/
case INVERT:
while ( form < formend ) {
*(mem++) ^= *(form++);
*(mem++) ^= *(form++);
*(mem++) ^= *(form++);
*(mem++) ^= *(form++);
*(mem++) ^= *(form++);
mem += RASTROWLEN-5;
form += BIGFONT/BYTESIZE-5;
}
break;
}
}