File: teklib

package info (click to toggle)
brandy 1.23.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,268 kB
  • sloc: ansic: 39,421; makefile: 91; sh: 1
file content (139 lines) | stat: -rw-r--r-- 3,174 bytes parent folder | download | duplicates (3)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
REM NOTE: this library can only be used in an xterm session under
REM Linux and NetBSD, or the Tektronix
:
REM This is a simple library that allows graphics to be plotted
REM in a xterm window running under NetBSD or Linux using the
REM Tektronics graphics terminal emulation that xterm offers.
:
REM The procedures and functions work in the same way that their
REM Basic statement counterparts do. The Tektronics screen has
REM a size of 1024 by 780 pixels. This library works in terms in
REM RISC OS graphics units so the screen dimensions according to
REM this code is 2048 graphics units by 1560.
:
:
REM PROCmode initialises the variables used by the library and
REM clears the graphics screen. It has to be called before any
REM other procedure in this library
:
:
:
REM PROCtekvdu allows for a slowed-down Tek drawing, to simulate a
REM serial-connected Tektronix terminal at approximately 9600bps
REM Use a MODE >= 128 to run at full speed.
:
DEF PROCtekvdu(v%)
IF tekfast% = 0 THEN SYS "Brandy_uSleep",890
SYS 6,43,v%
ENDPROC

REM PROCclg clears the graphics screen
:
DEF PROCclg
PROCtekvdu(27)
PROCtekvdu(12)
ENDPROC
:
DEF PROCmode(tekmode%)
tek_gcx%=0
tek_gcy%=0
tek_originx%=0
tek_originy%=0
IF tekmode% > 127 THEN tekfast% = 1 ELSE tekfast% = 0
PROCclg
ENDPROC
:
:
REM PROCorigin sets the coordinates of the graphics origin
:
DEF PROCorigin(X%, Y%)
tek_originx%=X%
tek_originy%=Y%
ENDPROC
:
:
REM PROCmove moves the graphics cursor to the coordinates given
:
DEF PROCmove(X%, Y%)
tek_gcx%=(X%+tek_originx%) DIV 2
tek_gcy%=(Y%+tek_originy%) DIV 2
ENDPROC
:
:
REM PROCdraw draws a line from the last graphics cursor position
REM to the coordinates given, making them the new cursor position
:
DEF PROCdraw(X%, Y%)
X%=(X%+tek_originx%) DIV 2
Y%=(Y%+tek_originy%) DIV 2
PROCtekvdu(29)
PROCtekvdu((tek_gcy%>>5)+32)
PROCtekvdu((tek_gcy% AND 31)+96)
PROCtekvdu((tek_gcx%>>5)+32)
PROCtekvdu((tek_gcx% AND 31)+64)
PROCtekvdu((Y%>>5)+32)
PROCtekvdu((Y% AND 31)+96)
PROCtekvdu((X%>>5)+32)
PROCtekvdu((X% AND 31)+64)
PROCtekvdu(31)
tek_gcx%=X%
tek_gcy%=Y%
ENDPROC
:
:
REM PROCline draws a line from the coordinates (sx, sy) to (ex, ey).
REM The graphics cursor position is set to (ex, ey) 
:
DEF PROCline(sx%, sy%, ex%, ey%)
sx%=(sx%+tek_originx%) DIV 2
sy%=(sy%+tek_originy%) DIV 2
ex%=(ex%+tek_originx%) DIV 2
ey%=(ey%+tek_originy%) DIV 2
PROCtekvdu(29)
PROCtekvdu((sy%>>5)+32)
PROCtekvdu((sy% AND 31)+96)
PROCtekvdu((sx%>>5)+32)
PROCtekvdu((sx% AND 31)+64)
PROCtekvdu((ey%>>5)+32)
PROCtekvdu((ey% AND 31)+96)
PROCtekvdu((ex%>>5)+32)
PROCtekvdu((ex% AND 31)+64)
PROCtekvdu(31)
tek_gcx%=ex%
tek_gcy%=ey%
ENDPROC
:
:
REM PROCpoint plots a single point
:
DEF PROCpoint(X%, Y%)
X%=(X%+tek_originx%) DIV 2
Y%=(Y%+tek_originy%) DIV 2
PROCtekvdu(29)
PROCtekvdu((Y%>>5)+32)
PROCtekvdu((Y% AND 31)+96)
PROCtekvdu((X%>>5)+32)
PROCtekvdu((X% AND 31)+64)
PROCtekvdu((Y%>>5)+32)
PROCtekvdu((Y% AND 31)+96)
PROCtekvdu((X%>>5)+32)
PROCtekvdu((X% AND 31)+64)
PROCtekvdu(31)
tek_gcx%=X%
tek_gcy%=Y%
ENDPROC
:
DEFPROCtekinit
tekfast%=0
PROCtekvdu(27)
PROCtekvdu(91)
PROCtekvdu(63)
PROCtekvdu(51)
PROCtekvdu(56)
PROCtekvdu(104)
ENDPROC
:
DEFPROCtekexit
PROCtekvdu(27)
PROCtekvdu(3)
ENDPROC