blob: 58c7a27183ce06125c602e29565a59ab87db9968 [file] [log] [blame] [raw]
Mark Pizzolato1e3586e2013-10-16 01:02:12 -07001/*
Mark Pizzolato94a06292016-02-08 16:43:36 -08002 * $Id: vtmacs.h,v 1.3 2004/01/24 20:54:54 phil Exp - revised by DAG $
Mark Pizzolato1e3586e2013-10-16 01:02:12 -07003 * macros for coding a VT11/VS60 display file (instructions and data)
4 * for standalone use of vt11.c (not embedded in PDP-11 simulator)
5 * Douglas A. Gwyn <gwyn@arl.army.mil>
6 * September 03, 2004
7 *
8 * XXX -- assumes ASCII host character set
9 */
10
11/* helper macros (not for use outside this header): */
12#define SGN_(x) ((x) < 0)
13#define MAG_(x) ((x) >= 0 ? (x) : -(x)) /* -0 not expressible directly in C */
14#if 0 /* manual seems to say this; wrong! */
15#define JDL_(x) ((SGN_(raddr) << 8) | MAG_(raddr))
16#else /* sign extend, 9-bit twos complement */
17#define JDL_(x) ((x) >= 0 ? (x) : ((~(unsigned)-(x))+1) & 0777)
18#endif
19
20/* control instructions: */
21
22/* load status register A: */
23#define LSRA(stop,stop_intr,lp_hit_chg,ital,refresh,menu) \
24 0170000 | stop | stop_intr | lp_hit_chg | ital | refresh | menu
25 /* display stop: */
26#define ST_SAME 00000 /* don't stop display */
27#define ST_STOP 02000 /* stop display */
28 /* stop interrupt: */
29#define SI_SAME 00000 /* no change */
30#define SI_INHIBIT 01000 /* inhibit interrupt on stop */
31#define SI_GENERATE 01400 /* generate interrupt on stop */
32 /* light pen hit intensify (bright-down on VS60): */
33#define LI_SAME 0000 /* no change */
34#define LI_INTENSIFY 0200 /* enable intensify on hit (VT11) */
35#define LI_BRIGHTDOWN 0200 /* enable bright down on hit (VS60) */
36#define LI_NOINTENSIFY 0300 /* inhibit intensify on hit (VT11) */
37#define LI_NOBRIGHTDOWN 0300 /* inhibit bright down on hit (VS60) */
38 /* italic font: */
39#define IT_SAME 000 /* no change */
40#define IT_NORMAL 040 /* normal font */
41#define IT_ITALIC 060 /* italic font */
42 /* refresh rate: */
43#define RF_UNSYNC 000 /* unsynchronized */
44#define RF_SAME 000 /* (happens to work like that) */
45#define RF_LINE 004 /* sync with line (VT11) */
46#define RF_30 004 /* 30 frames/sec (VS60) */
47#define RF_40 010 /* 40 frames/sec (VS60) */
48#define RF_EXT 014 /* external sync (VS60) */
49 /* menu/main area (VS60): */
50#define MN_SAME 0 /* no change */
51#define MN_MAIN 2 /* major screen area */
52#define MN_MENU 3 /* menu area */
53
54/* load status register B: */
55#define LSRB(color,set_step,step) \
56 0174000 | color | set_step | (step)
57 /* color select (VS60): */
58#define CL_SAME 00000 /* no change */
59#define CL_GREEN 01000 /* green */
60#define CL_YELLOW 01200 /* yellow */
61#define CL_ORANGE 01400 /* orange */
62#define CL_RED 01600 /* red */
63 /* graphplot increment register change enable: */
64#define SS_SAME 0000 /* no change (step value ignored) */
65#define SS_CHANGE 0100 /* write step value into register */
66
67/* load status register BB (VS60): */
68#define LSRBB(z_data,edge_intr,depth_cue,char_esc) \
69 0176000 | z_data | edge_intr | depth_cue | char_esc
70 /* file Z data: */
71#define ZD_SAME 000 /* no change */
72#define ZD_NO 010 /* d.file does not contain Z coords. */
73#define ZD_YES 014 /* d.file contains Z coordinates */
74 /* edge interrupts enable: */
75#define ED_SAME 000 /* no change */
76#define ED_DIS 040 /* disable intr. on edge transition */
77#define ED_ENA 060 /* enable intr. on edge transition */
78 /* depth cue processing: */
79#define DQ_SAME 0000 /* no change */
80#define DQ_OFF 0200 /* disable depth cueing (Z intensity) */
81#define DQ_ON 0300 /* enable depth cueing (Z intensity) */
82 /* escape on terminating character: */
83#define ES_SAME 0 /* no change */
84#define ES_NO 2 /* disable POPR on terminating char. */
85#define ES_YES 3 /* enable POPR on terminating char. */
86
87/* load status register C (VS60): */
88#define LSRC(rotate,cs_change,cscale,vs_change,vscale) \
89 0154000 | rotate | cs_change | ((cscale)<<5) | \
90 vs_change | (vscale)
91 /* character rotation: */
92#define RO_SAME 00000 /* no change */
93#define RO_HORIZONTAL 01000 /* no text rotation */
94#define RO_VERTICAL 01400 /* rotate text 90 degrees CCW */
95 /* character scale change enable: */
96#define CS_SAME 0000 /* no change (cscale value ignored) */
97#define CS_CHANGE 0200 /* set character scale */
98 /* vector scale change enable: */
99#define VS_SAME 000 /* no change (vscale value ignored) */
100#define VS_CHANGE 020 /* set vector scale */
101
102/* load scope selection register (VS60): */
103#define LSSR(console,disp,lp_intr,sw_intr) \
104 0164000 | console | disp | lp_intr | sw_intr
105 /* console to which this instruction applies: */
106#define CN_0 0000 /* console # 0 */
107#define CN_1 0400 /* console # 1 */
108 /* display enable: */
109#define DS_SAME 0000 /* no change */
110#define DS_DIS 0200 /* disable display (blank CRT) */
111#define DS_ENA 0300 /* enable display (use CRT) */
112 /* light-pen hit interrupt enable: */
113#define LH_SAME 0000 /* no change */
114#define LH_DIS 0040 /* light-pen hit interrupt disabled */
115#define LH_ENA 0060 /* light-pen hit interrupt enabled */
116 /* tip-switch transition interrupt enable: */
117#define SW_SAME 0000 /* no change */
118#define SW_DIS 0010 /* tip-switch interrupt disabled */
119#define SW_ENA 0014 /* tip-switch hit interrupt enabled */
120
121/* load name register (VS60): */
122#define LNR(name) \
123 0150000 | (name)
124
125/* set graphic mode: */
126#define SGM(mode,intens,lp_intr,blink,line_type) \
127 0100000 | mode | intens | lp_intr | blink | line_type
128 /* graphic mode: */
129#define GM_CHAR 000000 /* character */
130#define GM_SVECT 004000 /* short vector */
131#define GM_LVECT 010000 /* long vector */
132#define GM_APOINT 014000 /* absolute point, or offset */
133#define GM_GRAPHX 020000 /* graphplot X, or basic long vector */
134#define GM_GRAPHY 024000 /* graphplot Y, or basic long vector */
135#define GM_RPOINT 030000 /* relative point */
136#define GM_BSVECT 034000 /* basic short vector */
137#define GM_ARC 040000 /* circle/arc */
138#define GM_AVECT 044000 /* absolute vector */
139 /* intensity: */
140#define IN_SAME 00000 /* no change */
141#define IN_0 02000 /* intensity level 0 (dimmest) */
142#define IN_1 02200 /* intensity level 1 */
143#define IN_2 02400 /* intensity level 2 */
144#define IN_3 02600 /* intensity level 3 */
145#define IN_4 03000 /* intensity level 4 */
146#define IN_5 03200 /* intensity level 5 */
147#define IN_6 03400 /* intensity level 6 */
148#define IN_7 03600 /* intensity level 7 (brightest) */
149 /* light pen interrupt: */
150#define LP_SAME 0000 /* no change */
151#define LP_DIS 0100 /* light-pen hit interrupt disabled */
152#define LP_ENA 0140 /* light-pen hit interrupt enabled */
153 /* blink: */
154#define BL_SAME 000 /* no change */
155#define BL_OFF 020 /* blink off */
156#define BL_ON 030 /* blink on */
157 /* line type: */
158#define LT_SAME 00 /* no change */
159#define LT_SOLID 04 /* solid */
160#define LT_LDASH 05 /* long dash */
161#define LT_SDASH 06 /* short dash */
162#define LT_DDASH 07 /* dot dash */
163
164/* display jump absolute: */
165#define DJMP_ABS(addr) \
166 0160000, \
167 (addr) & ~1
168
169/* display jump relative (VS60) [raddr in words]: */
170#define DJMP_REL(raddr) \
171 0161000 | JDL_(raddr)
172
173/* display jump to subroutine absolute (VS60): */
174#define DJSR_ABS(addr) \
175 0162000, \
176 (addr) & ~1
177
178/* display jump to subroutine relative (VS60) [raddr in words]: */
179#define DJSR_REL(raddr) \
180 0163000 | JDL_(raddr)
181
182/* display no-op: */
183#define DNOP \
184 0164000
185
186/* display pop, no restore (VS60): */
187#define DPOP_NR \
188 0165000
189
190/* display pop, restore (VS60): */
191#define DPOP_R \
192 0165000
193
194/* display stop: */
195#define DSTOP LSRA(ST_STOP,SI_SAME,LI_SAME,IT_SAME,RF_UNSYNC,MN_SAME)
196
197/* graphic data: */
198
199 /* intensify enable (common to all modes exept CHAR and OFFSET): */
200#define I_OFF 000000 /* beam off */
201#define I_ON 040000 /* beam on */
202
203/* Note: when VS60 "file Z data" is enabled,
204 use the *3() macros instead of the corresponding normal ones. */
205
206/* character data: */
207#define CHAR(c1,c2) \
208 ((c2) << 8) | (c1) /* 7-bit ASCII assumed */
209
210/* short vector data: */
211#define SVECT(i,dx,dy) \
212 i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy)
213#define SVECT3(i,dx,dy,dz) \
214 i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy), \
215 (SGN_(dz) << 13) | (MAG_(dz) << 2)
216
217/* long vector data: */
218#define LVECT(i,dx,dy) \
219 i | (SGN_(dx) << 13) | MAG_(dx), \
220 (SGN_(dy) << 13) | MAG_(dy)
221#define LVECT3(i,dx,dy,dz) \
222 i | (SGN_(dx) << 13) | MAG_(dx), \
223 (SGN_(dy) << 13) | MAG_(dy), \
224 (SGN_(dz) << 13) | (MAG_(dz) << 2)
225
226/* rotation data (VS60, probably unimplemented): */
227#define ROTATE(i,a,b) \
228 i | (SGN_(a) << 13) | 010000 | MAG_(a), \
229 (SGN_(b) << 13) | MAG_(b)
230#define ROTATE3(i,a,b,c) \
231 i | (SGN_(a) << 13) | 010000 | MAG_(a), \
232 (SGN_(b) << 13) | MAG_(b), \
233 (SGN_(c) << 13) | (MAG_(c) << 2)
234
235/* absolute point data: */
236#define APOINT(i,x,y) \
237 i | (SGN_(x) << 13) | MAG_(x), \
238 (SGN_(y) << 13) | MAG_(y)
239#define APOINT3(i,x,y,z) \
240 i | (SGN_(x) << 13) | MAG_(x), \
241 (SGN_(y) << 13) | MAG_(y), \
242 (SGN_(z) << 13) | (MAG_(z) << 2)
243
244/* offset data (VS60): */
245#define OFFSET(x,y) \
246 (SGN_(x) << 13) | 010000 | MAG_(x), \
247 (SGN_(y) << 13) | 010000 | MAG_(y)
248#define OFFSET3(x,y,z) \
249 (SGN_(x) << 13) | 010000 | MAG_(x), \
250 (SGN_(y) << 13) | 010000 | MAG_(y), \
251 (SGN_(z) << 13) | 010000 | (MAG_(z) << 2)
252
253/* graphplot X data: */
254#define GRAPHX(i,x) \
255 i | (x)
256
257/* graphplot Y data: */
258#define GRAPHY(i,y) \
259 i | (y)
260
261/* basic long vector data (VS60): */
262#define BLVECT(i,dir,len) \
263 i | ((dir) << 11) | 02000 | (len)
264
265/* relative point data: */
266#define RPOINT(i,dx,dy) \
267 i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy)
268#define RPOINT3(i,dx,dy,dz) \
269 i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy), \
270 (SGN_(dz) << 13) | (MAG_(dz) << 2)
271
272/* basic short vector data (VS60): */
273#define BSVECT(i,dir1,len1,dir2,len2) \
274 i | ((dir2) << 11) | ((len2) << 7) | ((dir1) << 4) | (len1)
275
276/* circle/arc data (VS60, option): */
277#define ARC(i,dcx,dcy,dex,dey) \
278 i | (SGN_(dcx) << 13) | MAG_(dcx), \
279 (SGN_(dcy) << 13) | MAG_(dcy), \
280 (SGN_(dex) << 13) | MAG_(dex), \
281 (SGN_(dey) << 13) | MAG_(dey)
282#define ARC3(i,dcx,dcy,cz,dex,dey,ez) \
283 i | (SGN_(dcx) << 13) | MAG_(dcx), \
284 (SGN_(dcy) << 13) | MAG_(dcy), \
285 (SGN_(cz) << 13) | (MAG_(cz) << 2), \
286 (SGN_(dex) << 13) | MAG_(dex), \
287 (SGN_(dey) << 13) | MAG_(dey), \
288 (SGN_(ez) << 13) | (MAG_(ez) << 2)
289
290/* absolute vector data (VS60): */
291#define AVECT(i,x,y) \
292 i | (SGN_(x) << 13) | MAG_(x), \
293 (SGN_(y) << 13) | MAG_(y)
294#define AVECT3(i,x,y,z) \
295 i | (SGN_(x) << 13) | MAG_(x), \
296 (SGN_(y) << 13) | MAG_(y), \
297 (SGN_(z) << 13) | (MAG_(z) << 2)