aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/tv/iis/iism70/zreset.x
blob: 3d067d04879c3acc1cc228ffe8bb4b8f50f90103 (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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

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

# cfactor is conversion from integer to NDC coordinates (max 32767) for cursor
# see iiscursor.x
# The "hardness" notion is now somewhat obsolete...a range of reset values
# would be better, especially if better named.

define	CFACTOR	528

# ZRESET -- reset IIS 

procedure zreset (hardness)

short	hardness			# soft, medium, hard

short	data[LEN_IFM]
short	frames[IDS_MAXIMPL+1]
short	colors[IDS_MAXGCOLOR+1]
short	quad[5]
int	i,j

include	"iis.com"

begin
	if ( hardness == IDS_R_SNAPDONE ) {
	    call zsnap_done
	    return
	}

	# mark all frames
	do i = 1,IDS_MAXIMPL
	    frames[i] = i
	frames[IDS_MAXIMPL+1] = IDS_EOD
	# mark all colors
	do i = 1, IDS_MAXGCOLOR
	    colors[i] = i
	colors[IDS_MAXGCOLOR+1] = IDS_EOD
	# all quadrants
	do i = 1,4
	    quad[i] = i
	quad[5] = IDS_EOD

	if ( hardness == IDS_R_SOFT) {
	    # all coordinates are NDC ( 0 - 32767 )
	    # Reseting the "soft" parameters: scroll, constant offsets,
	    # split point, alu, zoom; turn cursor and tball on.
	    	
	    # constants
	    call aclrs (data,3)
	    call iisoffset(short(IDS_WRITE), colors, short(3), data)

	    # range
	    data[1] = 1
	    call iisrange (short(IDS_WRITE), colors, short(1), data)

	    # split point
	    call aclrs ( data, 2)
	    call iissplit(short(IDS_WRITE), short(2), data)

	    # alu
	    data[1] = 0
	    call iishdr(IWRITE, 1, ALU+COMMAND, 0, 0, 0, 0)
	    call iisio (data, 1 * SZB_CHAR)

	    # graphics status register
	    data[1] = 0
	    call iishdr(IWRITE, 1, GRAPHICS+COMMAND, 0, 0, 0, 0)
	    call iisio (data, 1 * SZB_CHAR)

	    # zoom
	    data[1] = 1
	    data[2] = IIS_XCEN * MCXSCALE		# gki mid point
	    data[3] = IIS_YCEN * MCYSCALE
	    data[4] = IDS_EOD
	    call iiszoom(short(IDS_WRITE), frames, short(4), data)

	    # scroll -- screen center to be centered
	    # zoom does affect scroll if zoom not power==1
	    # so to be safe, do scroll after zoom.
	    data[1] = IIS_XCEN * MCXSCALE
	    data[2] = IIS_YCEN * MCYSCALE
	    data[3] = IDS_EOD
	    call iisscroll(short(IDS_WRITE), frames, short(3), data)

	    # cursor and tball; no blink for cursor
	    data[1] = IDS_ON
	    call iiscursor(short(IDS_WRITE), short(1), short(1), data)
	    call iistball (short(IDS_WRITE), data)
	    data[1] = IDS_CBLINK
	    data[2] = IDS_CSTEADY
	    call iiscursor(short(IDS_WRITE), short(1), short(1), data)
    
	    # standard cursor shape
	    data[1] = IDS_CSHAPE
	    j = 2
	    # don't use last line/column so have a real center
	    for ( i = 0 ; i <= 62 ; i = i + 1 ) {
	        # make the puka in the middle
	        if ( (i == 30) || (i == 31) || (i == 32) )
		    next
	        # fill in the lines
	        data[j] = 31 * CFACTOR
	        data[j+1] = i * CFACTOR 
	        j = j + 2
	        data[j] = i * CFACTOR
	        data[j+1] = 31 * CFACTOR
	        j = j + 2
	    }
	    data[j] = IDS_EOD
	    call iiscursor ( short(IDS_WRITE), short(1), short(j), data)

	    return
	}
    
	if ( hardness == IDS_R_MEDIUM) {
	    # reset all tables to linear--ofm, luts, ifm
	    # ofm  (0,0) to (0.25,1.0) to (1.0,1.0)
	    data[1] = 0
	    data[2] = 0
	    data[3] = 0.25 * GKI_MAXNDC
	    data[4] = GKI_MAXNDC
	    data[5] = GKI_MAXNDC
	    data[6] = GKI_MAXNDC
	    call iisofm(short(IDS_WRITE), colors, short(1), short(6), data)

	    # luts
	    data[1] = 0
	    data[2] = 0
	    data[3] = GKI_MAXNDC
	    data[4] = GKI_MAXNDC
	    call iislut(short(IDS_WRITE), frames, colors, short(1),
	             short(4), data)

	    # ifm (0,0) to (1/32, 1.0) to (1.,1.)
	    # ifm is length 8192, but output is only 255.  So map linearly for
	    # first 256, then flat.  Other possibility is ifm[i] = i-1 ( for
	    # i = 1,8192) which relies on hardware dropping high bits.

	    data[1] = 0
	    data[2] = 0
	    data[3] = (1./32.) * GKI_MAXNDC
	    data[4] = GKI_MAXNDC
	    data[5] = GKI_MAXNDC
	    data[6] = GKI_MAXNDC
	    call iisifm(short(IDS_WRITE), short(1), short(6), data)

	    return
	}

	if (hardness == IDS_R_HARD) {
	    # clear all image/graph planes, and set channel selects to
	    # mono
	    call zclear(frames, frames, true)
	    call zclear(frames, frames, false)
	    # reset all to no display 
	    call zdisplay_i(short(IDS_OFF), frames, colors, quad)
	    call zdisplay_g(short(IDS_OFF), frames, colors, quad)
	}
end