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

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

define	INSERT		100000B

# ZDISPLAY_G -- Display the referenced graphics bitplanes in the given color(s)

procedure zdisplay_g (sw, bitpl, color, quad )

short	sw			# on or off
short	bitpl[ARB]		# bitpl list
short	color[ARB]		# color list
short	quad[ARB]		# quadrants to activate

short	gram[LEN_GRAM]
bool	off
int	i, lbound, val
short	mask[7]
short	fill
# red a bit weak so have contrast with cursor
#colors of graph: blue  grn   red    yellow  rd-bl   gn-bl  white
data	mask    /37B, 1740B, 74000B, 77740B, 74037B, 1777B, 77777B/

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

	# ignore bitpl argument since only one set of them and "color"
	# fully specifies them.
	# ignore quad for now
	# much manipulation of color graphics ram table required!!
	# strictly speaking, when we turn a plane off, we ought to be
	# sure that any plane which is on, and "beneath", is turned on;
	# this is a lot of trouble, so for starters, we don't.
	# first find out what is on

	call iishdr(IREAD+VRETRACE, LEN_GRAM, GRAPHICS, ADVXONTC, 0, 0, 0)
	call iisio (gram, LEN_GRAM * SZB_CHAR)

	# Check for red graphics plane for cursor

	if ( gram[LEN_GRAM/2+1] != 176000B )
	    call amovks ( short(176000B), gram[LEN_GRAM/2+1], LEN_GRAM/2)

	for ( i = 1 ;  color[i] != IDS_EOD ; i = i + 1 ) {
	    # Bit plane 8 reserved for cursor
	    if ( color[i] > 7 )
		next
	    # map IDS colors to IIS bit planes -- one-based.
	    switch (color[i]) {
		case IDS_RED:
		    val = RD
		case IDS_GREEN:
		    val = GR
		case IDS_BLUE:
		    val = BLU
		default:
		    val = color[i]
	    }
	    lbound = 2 ** (val - 1)
	    if ( off ) 
		call aclrs ( gram[lbound+1], lbound)
	    else
		call amovks ( short(INSERT+mask[val]), gram[lbound+1], lbound)
	}
	gram[1] = 0

	# If a bit plane is off, reset it with next "lower" one, thus
	# uncovering any planes masked by the one turned off.

	if (off) {
	    fill = 0
	    do i = 2, LEN_GRAM/2 {
		if (gram[i] == 0 )
		    gram[i] = fill
		else
		    fill = gram[i]
	    }
	}

	# Write out the data

	call iishdr(IWRITE+VRETRACE, LEN_GRAM, GRAPHICS, ADVXONTC, 0, 0, 0)
	call iisio (gram, LEN_GRAM * SZB_CHAR)
end