1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19*/
20//
21// d_varsa.s
22//
23
24#include "asm_i386.h"
25#include "quakeasm.h"
26#include "asm_draw.h"
27#include "d_ifacea.h"
28
29#if	id386
30
31	.data
32
33//-------------------------------------------------------
34// global refresh variables
35//-------------------------------------------------------
36
37// FIXME: put all refresh variables into one contiguous block. Make into one
38// big structure, like cl or sv?
39
40	.align	4
41.globl	C(d_sdivzstepu)
42.globl	C(d_tdivzstepu)
43.globl	C(d_zistepu)
44.globl	C(d_sdivzstepv)
45.globl	C(d_tdivzstepv)
46.globl	C(d_zistepv)
47.globl	C(d_sdivzorigin)
48.globl	C(d_tdivzorigin)
49.globl	C(d_ziorigin)
50C(d_sdivzstepu):	.single	0
51C(d_tdivzstepu):	.single	0
52C(d_zistepu):		.single	0
53C(d_sdivzstepv):	.single	0
54C(d_tdivzstepv):	.single	0
55C(d_zistepv):		.single	0
56C(d_sdivzorigin):	.single	0
57C(d_tdivzorigin):	.single	0
58C(d_ziorigin):		.single	0
59
60.globl	C(sadjust)
61.globl	C(tadjust)
62.globl	C(bbextents)
63.globl	C(bbextentt)
64C(sadjust):			.long	0
65C(tadjust):			.long	0
66C(bbextents):		.long	0
67C(bbextentt):		.long	0
68
69.globl	C(cacheblock)
70.globl	C(d_viewbuffer)
71.globl	C(cachewidth)
72.globl	C(d_pzbuffer)
73.globl	C(d_zrowbytes)
74.globl	C(d_zwidth)
75C(cacheblock):		.long	0
76C(cachewidth):		.long	0
77C(d_viewbuffer):	.long	0
78C(d_pzbuffer):		.long	0
79C(d_zrowbytes):		.long	0
80C(d_zwidth):		.long	0
81
82
83//-------------------------------------------------------
84// ASM-only variables
85//-------------------------------------------------------
86.globl	izi
87izi:			.long	0
88
89.globl	pbase, s, t, sfracf, tfracf, snext, tnext
90.globl	spancountminus1, zi16stepu, sdivz16stepu, tdivz16stepu
91.globl	zi8stepu, sdivz8stepu, tdivz8stepu, pz
92s:				.long	0
93t:				.long	0
94snext:			.long	0
95tnext:			.long	0
96sfracf:			.long	0
97tfracf:			.long	0
98pbase:			.long	0
99zi8stepu:		.long	0
100sdivz8stepu:	.long	0
101tdivz8stepu:	.long	0
102zi16stepu:		.long	0
103sdivz16stepu:	.long	0
104tdivz16stepu:	.long	0
105spancountminus1: .long	0
106pz:				.long	0
107
108.globl	izistep
109izistep:				.long	0
110
111//-------------------------------------------------------
112// local variables for d_draw16.s
113//-------------------------------------------------------
114
115.globl	reciprocal_table_16, entryvec_table_16
116// 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10, 1/11, 1/12, 1/13,
117// 1/14, and 1/15 in 0.32 form
118reciprocal_table_16:	.long	0x40000000, 0x2aaaaaaa, 0x20000000
119						.long	0x19999999, 0x15555555, 0x12492492
120						.long	0x10000000, 0xe38e38e, 0xccccccc, 0xba2e8ba
121						.long	0xaaaaaaa, 0x9d89d89, 0x9249249, 0x8888888
122
123#ifndef NeXT
124	.extern Entry2_16
125	.extern Entry3_16
126	.extern Entry4_16
127	.extern Entry5_16
128	.extern Entry6_16
129	.extern Entry7_16
130	.extern Entry8_16
131	.extern Entry9_16
132	.extern Entry10_16
133	.extern Entry11_16
134	.extern Entry12_16
135	.extern Entry13_16
136	.extern Entry14_16
137	.extern Entry15_16
138	.extern Entry16_16
139#endif
140
141entryvec_table_16:	.long	0, Entry2_16, Entry3_16, Entry4_16
142					.long	Entry5_16, Entry6_16, Entry7_16, Entry8_16
143					.long	Entry9_16, Entry10_16, Entry11_16, Entry12_16
144					.long	Entry13_16, Entry14_16, Entry15_16, Entry16_16
145
146//-------------------------------------------------------
147// local variables for d_parta.s
148//-------------------------------------------------------
149.globl	DP_Count, DP_u, DP_v, DP_32768, DP_Color, DP_Pix, DP_EntryTable
150DP_Count:		.long	0
151DP_u:			.long	0
152DP_v:			.long	0
153DP_32768:		.single	32768.0
154DP_Color:		.long	0
155DP_Pix:			.long	0
156
157
158#ifndef NeXT
159	.extern DP_1x1
160	.extern DP_2x2
161	.extern DP_3x3
162	.extern DP_4x4
163#endif
164
165DP_EntryTable:	.long	DP_1x1, DP_2x2, DP_3x3, DP_4x4
166
167//
168// advancetable is 8 bytes, but points to the middle of that range so negative
169// offsets will work
170//
171.globl	advancetable, sstep, tstep, pspantemp, counttemp, jumptemp
172advancetable:	.long	0, 0
173sstep:			.long	0
174tstep:			.long	0
175
176pspantemp:		.long	0
177counttemp:		.long	0
178jumptemp:		.long	0
179
180// 1/2, 1/3, 1/4, 1/5, 1/6, and 1/7 in 0.32 form
181.globl	reciprocal_table, entryvec_table
182reciprocal_table:	.long	0x40000000, 0x2aaaaaaa, 0x20000000
183					.long	0x19999999, 0x15555555, 0x12492492
184
185#ifndef NeXT
186	.extern Entry2_8
187	.extern Entry3_8
188	.extern Entry4_8
189	.extern Entry5_8
190	.extern Entry6_8
191	.extern Entry7_8
192	.extern Entry8_8
193#endif
194
195entryvec_table:	.long	0, Entry2_8, Entry3_8, Entry4_8
196				.long	Entry5_8, Entry6_8, Entry7_8, Entry8_8
197
198#ifndef NeXT
199	.extern Spr8Entry2_8
200	.extern Spr8Entry3_8
201	.extern Spr8Entry4_8
202	.extern Spr8Entry5_8
203	.extern Spr8Entry6_8
204	.extern Spr8Entry7_8
205	.extern Spr8Entry8_8
206#endif
207
208.globl spr8entryvec_table
209spr8entryvec_table:	.long	0, Spr8Entry2_8, Spr8Entry3_8, Spr8Entry4_8
210					.long	Spr8Entry5_8, Spr8Entry6_8, Spr8Entry7_8, Spr8Entry8_8
211
212#endif	// id386
213
214