aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/tv/iis/iism70/zdisplay_i.x
blob: e08db8c35848f0eb997aaf5bfd85bcbd4c9782cd (plain) (blame)
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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include <mach.h>
include "../lib/ids.h"
include "iis.h"

# ZDISPLAY_I -- Display the referenced image planes in the given color(s)
# and in the given quadrants of the screen.

procedure zdisplay_i (sw, frames, color, quad)

short	sw			# on or off
short	frames[ARB]		# frame list
short	color[ARB]		# color list
short	quad[ARB]		# quadrant list


bool	off
short	channels
short	select[LEN_SELECT]
int	q,c,index, temp
int	mq			# mapped quadrant
int	mapquad()
short	iispack()
int	and(), or(), xor()

include	"iis.com"
include "../lib/ids.com"	# for i_maxframes! only

begin
	if ( sw == IDS_ON ) {
	    off = false
	} else
	    off = true

	# first find out what is on
	call iishdr(IREAD+VRETRACE, LEN_SELECT, COMMAND+LUT, ADVXONTC, 0,0,0)
	call iisio (select, LEN_SELECT * SZB_CHAR)

	# then add in/remove frames
	channels = iispack(frames)

	for ( q = 1 ; quad[q] != IDS_EOD ; q = q + 1 ) {
	    mq = mapquad(quad[q])
	    if ( ! off ) {
	        for ( c =1 ; color[c] != IDS_EOD ; c = c + 1 ) {
		    switch ( color[c] ) {
		        case IDS_RED:
			    index = mq + 8

		        case IDS_GREEN:
			    index = mq + 4

		        case IDS_BLUE:
			    index = mq
		    }
		    select[index] = or ( int(channels), int(select[index]) )
		}
	    } else {
	        for ( c =1 ; color[c] != IDS_EOD ; c = c + 1 ) {
		    switch ( color[c] ) {
		        case IDS_RED:
			    index = mq + 8

		        case IDS_GREEN:
			    index = mq + 4

		        case IDS_BLUE:
			    index = mq
		    }
		    select[index] = and ( xor ( 177777B, int(channels)),
		   			 int(select[index]))
		}
	    }
	}

	# Record which frame is being displayed for cursor readback.
	temp = 0
	do q = 1, LEN_SELECT
	    temp = or (temp, int(select[q]))

	if ( temp == 0)
	    i_frame_on = ERR
	else {
	    do q = 1, i_maxframes {
		if (and (temp, 2**(q-1)) != 0) {
		    i_frame_on = q
		    break
		}
	    }
	}
	call iishdr(IWRITE+VRETRACE, LEN_SELECT, COMMAND+LUT, ADVXONTC, 0,0,0)
	call iisio (select, LEN_SELECT * SZB_CHAR)
end


# MAPQUAD -- map user quadrant to device ... returns ONE-based quadrant
# if prefer ZERO-based, add one to "index" computation above.

int procedure mapquad (quadrant)

short quadrant

int	mq

begin
	switch ( quadrant ) {
	    case 1:
		mq = 2

	    case 2:
		mq = 1

	    case 3:
		mq = 3
	    
	    case 4:
		mq = 4
	    
	    default:
		mq = 1		# should never happen
	}
	return (mq)
end