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

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

# IDS_ESCAPE -- Pass a device dependent instruction on to the kernel.  
# Most of the display control work is done here.

procedure ids_escape (fn, instruction, nwords)

int	fn				# function code
short	instruction[ARB]		# instruction data words
int	nwords				# length of instruction

pointer p,q
int	ids_dcopy()
short	frames[IDS_MAXIMPL+2]		# storage for frame data
short	color[IDS_MAXGCOLOR+1]		# ditto for color
short	bitpl[IDS_MAXBITPL+1]		# ditto for graphics bit plane
short	quad[5]				# 4 quadrant information
int	count, count2, total
int	junk

short	gki[GKI_ESCAPE_LEN]
data	gki[1] /BOI/, gki[2] /GKI_ESCAPE/

include "../lib/ids.com"

begin
	switch(fn) {
	    
	    case IDS_RESET:
		call ids_reset(instruction[1])

	    case IDS_SET_IP:
		p = IDS_FRAME(i_kt)
		count = ids_dcopy(instruction[1], Mems[p])
		call ids_expand(Mems[p],i_maxframes, true)
		q = IDS_BITPL(i_kt)
		junk = ids_dcopy ( instruction[count+1], Mems[q])
		call ids_expand(Mems[q],IDS_MAXBITPL, false)
		i_image = true
		call zsetup (Mems[p], Mems[q], i_image)

	    case IDS_SET_GP:
		p = IDS_FRAME(i_kt)
		count = ids_dcopy(instruction[1], Mems[p])
		call ids_expand(Mems[p],i_maxgraph, false)
		q = IDS_BITPL(i_kt)
		junk = ids_dcopy ( instruction[count+1], Mems[q])
		call ids_expand(Mems[q],IDS_MAXBITPL, false)
		i_image = false
		call zsetup (Mems[p], Mems[q], i_image)

	    case IDS_DISPLAY_I:
		count = ids_dcopy(instruction[2], frames[1])
		call ids_expand(frames[1], i_maxframes, true)
		count2 = ids_dcopy (instruction[2+count], color[1])
		call ids_expand(color[1], IDS_MAXGCOLOR, false)
		total = count + count2
		count = ids_dcopy(instruction[total+2], quad[1])
		call ids_expand(quad[1], 4, false)
		call zdisplay_i(instruction[1], frames[1], color, quad)

	    case IDS_DISPLAY_G:
		count = ids_dcopy(instruction[2], bitpl[1])
		call ids_expand(bitpl[1], i_maxgraph, false)
		count2 = ids_dcopy (instruction[2+count], color[1])
		call ids_expand(color[1], IDS_MAXGCOLOR, false)
		total = count + count2
		count = ids_dcopy(instruction[total+2], quad[1])
		call ids_expand(quad[1], 4, false)
		call zdisplay_g(instruction[1], bitpl, color, quad)

	    case IDS_SAVE:
		call idssave(instruction[1], nwords)

	    case IDS_RESTORE:
		call idsrestore(instruction[1], nwords)

	    case IDS_CONTROL:
		count = ids_dcopy(instruction[IDS_CTRL_FRAME], frames[1])
		call ids_expand(frames[1], i_maxframes, true)
		count2 = ids_dcopy (instruction[IDS_CTRL_FRAME+count], color[1])
		call ids_expand(color[1], IDS_MAXGCOLOR, false)
		total = count + count2
		call zcontrol(instruction[IDS_CTRL_REG],
			instruction[IDS_CTRL_RW],
			frames[1], color[1],
			instruction[total+IDS_CTRL_FRAME],
			instruction[IDS_CTRL_N],
			instruction[total+IDS_CTRL_FRAME+1] )
		# if a read, would like to return the information in gki format
		# but no mechanism (yet?) for that
	}
end

# IDS_DCOPY -- copy frame and bitplane information; return the number of
# items copied, including the IDS_EOD (whose presence is required and assumed).

int procedure ids_dcopy(from, to)

short	from[ARB]		# from this storage
short	to[ARB]			# to this area

int	i			# count

begin
	i = 0
	repeat {
	    i = i + 1
	    to[i] = from[i]
	} until ( to[i] == IDS_EOD )
	return (i)
end