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
|
/*
* Copyright 1996-2002 - Karl R. Hakimian and David Fries
*
* This file is part of datalink.
*
* Datalink is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Datalink is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with datalink (see COPYING); if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/*
* SVGA Macros for sending data to the datalink watch.
*
* Modified by David Fries <dfries@mail.win.org> 7/11/99
* - Added support for the Timex Datalink Ironman Triathlon
* - Modified the screen position and only send half the initial sync signals
*
*/
// This defines which line to start field 1 at
#define START1 70
// The line to start field 2 at
#define START2 255
// the distance between lines in each field
#define SPACE 15
#define WRITE_BYTE1(sb, byte) { \
int pos = START1; \
register int mask = 0x1; \
if (sb) \
vga_drawscanline(pos, white); \
else \
vga_drawscanline(pos, black); \
pos += SPACE; \
while (mask < 0xff) { \
if (mask&byte) \
vga_drawscanline(pos, black); \
else \
vga_drawscanline(pos, white); \
pos += SPACE; \
mask = mask << 1; \
} \
}
#define WRITE_BYTE2(sb, byte) { \
int pos = START2; \
register int mask = 1; \
if (sb) \
vga_drawscanline(pos, white); \
else \
vga_drawscanline(pos, black); \
pos += SPACE; \
while (mask < 0xff) { \
if (mask&byte) \
vga_drawscanline(pos, black); \
else \
vga_drawscanline(pos, white); \
pos += SPACE; \
mask = mask << 1; \
} \
}
#define END_PACKET { \
vga_waitretrace(); \
WRITE_BYTE1(0, 0xff) \
WRITE_BYTE2(0, 0xff) \
{int i; for (i = 0; i < (10+((type==DATALINK_IRONMAN)?2:0)); i++) \
vga_waitretrace();} \
}
/* how many syncs to give to begin with, was 400 */
#define SYNC { \
register int i; \
for (i = 0; i < 200; i++) { \
vga_waitretrace(); \
WRITE_BYTE1(1, 0x55) \
WRITE_BYTE2(1, 0x55) \
} \
END_PACKET \
}
#define DATASTART { \
register int i; \
for (i = 0; i < 50; i++) { \
vga_waitretrace(); \
WRITE_BYTE1(1, 0xAA) \
} \
END_PACKET \
}
|