]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - packages/services/gfx/mw/v2_0/src/drivers/asm_prsm.s
Initial revision
[karo-tx-redboot.git] / packages / services / gfx / mw / v2_0 / src / drivers / asm_prsm.s
1 | Routines to interface C to the graphics card in the Prisma
2 | These replace the ROM routines.
3 |
4 | 0.1  16/02/99  G.Harvey       first created
5 | 0.11 19/02/99  G.Harvey       optimise line drawing (c_ldraw4())
6 | 0.2  20/02/99  G.Harvey       add read/write pixel
7 | 0.3  21/02/99  G.Harvey       add video init routines
8 | 0.4  23/02/99  G.Harvey       add r1pix
9 | 0.41 26/02/99  G.Harvey       add w1pix
10 | 0.5  27/02/99  G.Harvey       add rd_rect, wr_rect
11 | 0.51 02/03/99  G.Harvey       add wr_rect5
12
13 | Base addr of GC video buffer control registers
14
15 GC_BASE         = 0x200440
16
17 | GC Video Buffer write registers (offsets from the base addr)
18
19 GCW_CE          = 0x00  | chip enable
20 GCW_PSEL        = 0x04  | plane select
21 GCW_INTEN       = 0x08  | intensity write data
22 GCW_CMD         = 0x0c  | command
23 GCW_CMAP        = 0x10  | colour map address / data
24 GCW_DAC         = 0x14  | DAC / video control
25 GCW_PY_SM       = 0x18  | pixel Y address / start single mem cycle
26 GCW_IN_SM       = 0x1c  | intensity write data / start single mem cycle
27 GCW_PX_SL       = 0x20  | pixel X address / start line
28 GCW_PX_SM       = 0x24  | pixel X address / start single mem cycle
29 GCW_PY          = 0x28  | pixel Y address
30 GCW_PX          = 0x2c  | pixel X address
31 GCW_LG1         = 0x30  | line generation algorithm
32 GCW_LG2         = 0x34  | line generation algorithm
33 GCW_LG3         = 0x38  | line generation algorithm
34 GCW_LG4         = 0x3c  | line generation algorithm
35
36 | GC Video Buffer read registers (offsets from the base addr)
37
38 GCR_INTEN       = 0x00  | read intensity
39 GCR_RESV        = 0x04  | reserved
40 GCR_CMAP        = 0x08  | read colour map
41 GCR_STATUS      = 0x0c  | read VBUSY, VBLANK status
42 GCR_IN_SM       = 0x10  | read intensity / start single mem cycle
43
44         .text
45
46 | Video init 1
47 | from LAB_0367 at 0x00104760
48
49         .even
50 .globl  init_scr
51 init_scr:
52 init1:
53         movel   d0,sp@-
54         movel   a0,sp@-
55         lea     GC_BASE,a0      | base of video control registers
56         clrl    a0@(GCW_LG3)
57         tstl    a0@(524)        | 0x20064c - CMD reg but inhibit command
58 init1_1:
59         btst    #6,a0@(524)     | GCR_STATUS with command inhibit
60         beq     init1_1         | wait for VBLANK ? 
61 init1_2:
62         btst    #5,a0@(524)     | GCR_STATUS
63         bne     init1_2         | VBLANK ?
64         clrl    a0@(GCW_CMAP)   | colour map
65         moveq   #0x17,d0
66         clrl    a0@(GCW_CMAP)
67         movel   d0,a0@(GCW_DAC)
68         moveq   #0x1b,d0
69         clrl    a0@(GCW_CMAP)
70         movel   d0,a0@(GCW_DAC)
71         moveq   #0x1f,d0
72         clrl    a0@(GCW_CMAP)
73         movel   d0,a0@(GCW_DAC)
74         moveq   #6,d0
75         moveb   d0,init_flag1   | ??
76         moveq   #7,d0
77         moveb   d0,line_flag
78         clrl    d0
79         moveb   line_flag,d1
80         btst    #2,d1
81         beq     init1_3
82         orw     #0x100,d0
83 init1_3:
84         notb    d1
85         andb    #3,d1
86         orb     d1,d0
87         clrl    d1
88         moveb   init_flag1,d1
89         lsll    #5,d1
90         orl     d1,d0
91         movel   d0,a0@(GCW_DAC)
92         movel   #0x1ff,line_selmask
93         bsr     init3
94         bsr     init2
95         moveal  sp@+,a0
96         movel   sp@+,d0
97         rts
98
99 | Video init 2
100 | LAB_036B at 0x0010047f4
101
102         .even
103 init2:
104         link    a6,#0
105         moveml  d2-d7/a2-a5,sp@-
106         moveal  #0x118808,a3
107         clrw    init_flag2
108 init2_1:
109         moveq   #0x10,d0
110         cmpw    init_flag2,d0
111         ble     init2_7
112         movew   init_flag2,init_flag3
113         moveb   a3@+,d7
114         andw    #0xff,d7
115         moveb   a3@+,d6
116         extw    d6
117         moveb   a3@+,d5
118         andw    #0xff,d5
119         moveb   a3@+,d4
120         extw    d4
121         moveb   a3@+,d3
122         andw    0xff,d3
123         moveb   a3@+,d2
124         extw    d2
125         moveal  init_flag4,a2
126         clrw    init_flag5
127 init2_2:
128         moveq   #16,d0
129         cmpw    init_flag5,d0   | 06F4
130         ble     init2_6
131         movew   init_flag3,d1   | 06F8
132         extl    d1
133         moveq   #24,d0
134         lsll    d0,d1
135         movel   d1,init_flag6   | 6F0
136         movew   d7,d1
137         extl    d1
138         moveq   #16,d0
139         lsll    d0,d1
140         orl     d1,init_flag6   | 6F0
141         movew   d5,d1
142         extl    d1
143         lsll    #8,d1
144         orl     d1,init_flag6   | 6F0
145         movew   d3,d1
146         extl    d1
147         orl     d1,init_flag6
148         movel   init_flag6,a2@+ | store map entry in table
149         movew   d7,d1
150         extl    d1
151         movew   d6,d0
152         extl    d0
153         addl    d0,d1
154         movew   d1,d7
155         movew   d5,d0
156         extl    d0
157         movew   d4,d1
158         extl    d1
159         addl    d1,d0
160         movew   d0,d5
161         movew   d3,d0
162         extl    d0
163         movew   d2,d1
164         extl    d1
165         addl    d1,d0
166         movew   d0,d3
167         cmpw    #0xff,d7
168         ble     init2_3
169         movew   #0xff,d7
170 init2_3:
171         cmpw    #0xff,d5
172         ble     init2_4
173         movew   #0xff,d5
174 init2_4:
175         cmpw    #0xff,d3
176         ble     init2_5
177         movew   #0xff,d3
178 init2_5:
179         moveq   #16,d0
180         addw    d0,init_flag3   | 06F8
181         addqw   #1,init_flag5   | 06F4
182         bra     init2_2
183 init2_6:
184         pea     init_flag4      | start of colour map
185         moveq   #16,d0          | no. of entries
186         movel   d0,sp@-
187         bsr     c_pcmap | write colour map to video board
188         addql   #8,sp
189         addqw   #1,init_flag2   | 06F6
190         bra     init2_1
191 init2_7:
192         moveml  sp@+,d2-d7/a2-a5
193         unlk    a6
194         rts
195
196
197 | C entry to program the colour map
198 | c_pcmap(int len, int *map)
199 |
200 | the format of the map appears to be an array of longwords, each word
201 | contains an index value and the values for R, G and B, all 8 bits.
202 | Format is: :INDEX:RED:GREEN:BLUE:
203
204         .even
205 .globl  c_pcmap
206 c_pcmap:
207         link    a6,#0
208         movel   a5,sp@-
209         movel   d7,sp@-
210         moveal  a6@(12),a5      | point to colour map
211         movel   a6@(8),d7       | no. of entries
212         bsr     pcmap1
213         movel   sp@+,d7
214         moveal  sp@+,a5
215         unlk    a6
216         rts
217
218 | program colour map 1
219 | looks like you can only set a maximum of 127 entries at a time
220
221         .even
222 pcmap1:
223         moveml  d0-d7/a0-a6,sp@-
224         moveq   #0x17,d0
225         moveq   #0x1b,d1
226         moveq   #0x1f,d2
227         subql   #1,d7
228         btst    #7,d7
229         bne     pcmap1_1        | bra if more than 127 entries
230         bsr     pcmap2
231         bra     pcmap1_2        | done
232 pcmap1_1:
233         subl    #0x7f,d7
234         movel   d7,sp@-
235         moveq   #0x7f,d7
236         bsr     pcmap2          | first 127 entries
237         movel   sp@+,d7
238         bsr     pcmap2          | remainder of entries
239 pcmap1_2:
240         moveml  sp@+,d0-d7/a0-a6
241         rts
242
243 | program colour map 2
244 | this subroutine actually writes to the colour map on the video
245 | board
246
247         .even
248 pcmap2:
249         lea     GC_BASE,a0      | pint to control registers
250         tstl    a0@(524)        | wait for VBLANK
251 pcmap2_1:
252         btst    #6,a0@(524)
253         beq     pcmap2_1
254 pcmap2_2:
255         btst    #6,a0@(524)
256         bne     pcmap2_2
257 pcmap2_3:
258         movel   a5@+,d3         | map entry
259         movew   d3,d5
260         swap    d3
261         movel   d5,d4
262         rorl    #8,d4
263         movel   d3,a0@(GCW_CMAP) | upper 8 bits is addr, lower is data
264         movel   d0,a0@(GCW_DAC) | write RED
265         moveb   d4,d3
266         movel   d3,a0@(GCW_CMAP)
267         movel   d1,a0@(GCW_DAC) | write GREEN
268         moveb   d5,d3
269         movel   d3,a0@(GCW_CMAP)
270         movel   d2,a0@(GCW_DAC) | write BLUE
271         tstw    d7
272         dbeq    d7,pcmap2_3     | loop
273         clrl    a0@(GCW_CMAP)
274         clrl    d0
275 |       moveb   line_flag,d1
276         moveb   #7,d1           | line_flag when ROM monitor active
277         btst    #2,d1
278         beq     pcmap2_4
279         orw     #0x100,d0       | overlay on
280 pcmap2_4:
281         notb    d1
282         andb    #3,d1
283         orb     d1,d0
284         clrl    d1
285 |       moveb   init_flag1,d1
286         moveb   #6,d1           | init_flag1 when ROM monitor active
287         lsll    #5,d1           | overlay colour ?
288         orl     d1,d0
289         movel   d0,a0@(GCW_DAC) | set overlay colour & operating mode
290         rts
291
292 | Init 3
293 | LAB_0389 at 0x001004b0c
294
295         .even
296 init3:
297         moveml  d0-d7/a0,sp@-
298         movel   line_selmask,d6
299         moveq   #5,d7
300         clrl    d0
301         clrl    d5
302         moveq   #-1,d1
303         movel   d1,d2
304         movew   #0xfb00,d1
305         movew   #0xf602,d2
306         movel   #0x04fe,d3
307         moveq   #7,d4
308         lea     GC_BASE,a0      | base of video control registers
309 init3_1:
310         movel   d0,a0@(GCW_INTEN)       | intensity
311         movel   d6,a0@(GCW_PSEL)        | plane select
312         movel   #0x0e,a0@(GCW_CMD)      | command
313         movel   d1,a0@(GCW_LG2)         | line draw
314         movel   d0,a0@(GCW_LG1)         | line draw
315         movel   d2,a0@(GCW_LG2)         | line draw
316         movel   d3,a0@(GCW_LG3)         | line draw
317         movel   d4,a0@(GCW_LG4)         | line draw
318         movel   d5,a0@(GCW_PY)          | pixel Y addr
319         movel   d0,a0@(GCW_PX_SL)       | pixel X addr, start line
320         addql   #1,d5                   | incr Y addr
321         cmpw    d7,d5
322         bne     init3_1
323         clrl    d2
324         movel   #0x03fc,d3
325         moveq   #19,d0
326         moveq   #27,d1
327         movel   d6,a0@(GCW_PSEL)        | plane select
328         tstl    a0@(524)                | 0x20064c - CMD reg but inhibit cmd
329 init3_2:
330         movel   a0@(524),d4
331         btst    #0x1e,d4
332         beq     init3_2
333 init3_3:
334         movel   a0@(524),d4
335         btst    #0x1e,d4
336         bne     init3_3
337         movel   d0,a0@(GCW_CMD)         | command
338         movel   d2,a0@(GCW_PY_SM)       | pixel Y addr, start mem cycle
339 init3_4:
340         movel   d1,a0@(GCW_CMD)         | command
341         movel   d3,a0@(GCW_PY_SM)       | pixel Y addr, start mem cycle
342         subql   #4,d3
343         bpl     init3_4
344         moveml  sp@+,d0-d7/a0
345         rts
346
347 | in-lined version of ldraw
348
349         .even
350 .globl  c_ldraw4
351 c_ldraw4:
352         link    a6,#0
353         moveml  d0-d7/a0-a6,sp@-
354         lea     gr_data,a1      | point to data space
355         movel   a6@(8),d2       | x1
356         movel   a6@(12),d3      | y1
357         movel   a6@(16),d1      | x2
358         movel   a6@(20),d0      | y2
359         moveb   #0x03,line_flag         | magic number ?
360
361         moveq   #1,d5
362         movel   d5,a1@(40)      | set x direction flag
363         movel   d5,a1@(44)      | set y direction flag
364         subl    d2,d1           | (d1-d2)->d1, (x2 - x1) -> d1
365         movel   d1,a1@(16)      | delta-x
366
367         subl    d3,d0           | (y2 - y1) -> d0
368         movel   d0,a1@(20)      | delta-y
369         cmpl    d1,d0           | delta-y - delta-x
370         bgt     ldraw4_6        | bra if delta-y > delta-x
371         movel   d5,d0           | set d0 to 1
372         bra     ldraw4_7
373 ldraw4_6:
374         clrl    d0              | set d0 to 0
375 ldraw4_7:
376         movel   d0,a1@(48)      | set to 0 if delta-y > delta-x, else set to 1
377         beq     ldraw4_8        | bra if delta-y > delta-x
378         movel   a1@(20),d5      | delta-y to d5
379         lsll    #1,d5           | shift left (mul by 2)
380         movel   d5,d4           | copy to d4
381         subl    a1@(16),d4      | (2 * dy) - dx -> d4
382         subl    a1@(40),d4      | d4 - xdir -> d4
383         movel   a1@(16),d6      | dx -> d6
384         movel   a1@(20),d7      | dy -> d7
385         subl    d6,d7           | dy - dx -> d7
386         lsll    #1,d7           | shift left, d7 = ND/NA
387         bra     ldraw4_9
388 ldraw4_8:
389         movel   a1@(16),d5      | dx
390         lsll    #1,d5           | shift left (mul by 2)
391         movel   d5,d4
392         subl    a1@(20),d4      | (2 * dx) - dy
393         subl    a1@(44),d4      | ydir
394         movel   a1@(20),d6      | dy
395         movel   a1@(16),d7      | dx
396         subl    d6,d7
397         lsll    #1,d7           | shift left, d7 = ND/NA
398 ldraw4_9:
399
400 | by this point, d4 = ND/NA, d5 = NB
401
402         subql   #1,d6           | d6 = NC
403         movel   a1@(40),d0      | xdir
404         lsll    #1,d0
405         orl     a1@(44),d0      | ydir
406         lsll    #1,d0
407         orl     a1@(48),d0      | SX/SY
408
409         lea     GC_BASE,a0      | point to video control registers
410         movel   a6@(24),a0@(GCW_INTEN)          | intensity
411         movel   a6@(28),a0@(GCW_PSEL)           | plane select
412         movel   #0x0e,a0@(GCW_CMD)              | write, 4x5, 1 of 20
413         tstl    a1@(16)
414         bne     ldraw41
415         tstl    a1@(20)
416         bne     ldraw41
417         movel   d3,a0@(GCW_PY)          | pixel Y addr
418         movel   d2,a0@(GCW_PX_SM)       | pixel X addr, start single mem
419         bra     ldraw4_done
420 ldraw41:
421         movel   d4,a0@(GCW_LG2)         | line gen, ND15-ND0
422         movel   d5,a0@(GCW_LG1)         | line gen, NB15-NB0
423         movel   d7,a0@(GCW_LG2)         | line gen, ND15-ND0
424         movel   d6,a0@(GCW_LG3)         | line-gen, NC11-NC0
425         movel   d0,a0@(GCW_LG4)         | line-gen, SX, SY, XMAJ
426         movel   d3,a0@(GCW_PY)          | pixel Y
427         movel   d2,a0@(GCW_PX_SL)       | pixel X, start line
428 ldraw4_done:
429         moveml  sp@+,d0-d7/a0-a6
430         unlk    a6
431         rts
432
433 | in-lined version of ldraw including y loop counter
434
435         .even
436 .globl  c_ldraw4y
437 c_ldraw4y:
438         link    a6,#0
439         moveml  d0-d7/a0-a2,sp@-
440         lea     gr_data,a1      | point to data space
441         movel   a6@(8),d2       | x1
442         movel   a6@(12),d3      | y1
443         movel   a6@(20),a2      | y3
444 ldraw4y_1:
445         cmpl    d3,a2
446         jge     ldraw4y_2
447         jra     ldraw4y_11
448 ldraw4y_2:
449         movel   a6@(16),d1      | x2
450         movel   a6@(12),d0      | y2 = y1
451         moveb   #0x03,line_flag | magic number ?
452
453         moveq   #1,d5
454         movel   d5,a1@(40)      | set x direction flag
455         movel   d5,a1@(44)      | set y direction flag
456         subl    d2,d1           | (d1-d2)->d1, (x2 - x1) -> d1
457         movel   d1,a1@(16)      | delta-x
458
459         subl    d3,d0           | (y2 - y1) -> d0
460         movel   d0,a1@(20)      | delta-y
461         cmpl    d1,d0           | delta-y - delta-x
462         bgt     ldraw4y_6       | bra if delta-y > delta-x
463         movel   d5,d0           | set d0 to 1
464         bra     ldraw4y_7
465 ldraw4y_6:
466         clrl    d0              | set d0 to 0
467 ldraw4y_7:
468         movel   d0,a1@(48)      | set to 0 if delta-y > delta-x, else set to 1
469         beq     ldraw4y_8       | bra if delta-y > delta-x
470         movel   a1@(20),d5      | delta-y to d5
471         lsll    #1,d5           | shift left (mul by 2)
472         movel   d5,d4           | copy to d4
473         subl    a1@(16),d4      | (2 * dy) - dx -> d4
474         subl    a1@(40),d4      | d4 - xdir -> d4
475         movel   a1@(16),d6      | dx -> d6
476         movel   a1@(20),d7      | dy -> d7
477         subl    d6,d7           | dy - dx -> d7
478         lsll    #1,d7           | shift left, d7 = ND/NA
479         bra     ldraw4y_9
480 ldraw4y_8:
481         movel   a1@(16),d5      | dx
482         lsll    #1,d5           | shift left (mul by 2)
483         movel   d5,d4
484         subl    a1@(20),d4      | (2 * dx) - dy
485         subl    a1@(44),d4      | ydir
486         movel   a1@(20),d6      | dy
487         movel   a1@(16),d7      | dx
488         subl    d6,d7
489         lsll    #1,d7           | shift left, d7 = ND/NA
490 ldraw4y_9:
491
492 | by this point, d4 = ND/NA, d5 = NB
493
494         subql   #1,d6           | d6 = NC
495         movel   a1@(40),d0      | xdir
496         lsll    #1,d0
497         orl     a1@(44),d0      | ydir
498         lsll    #1,d0
499         orl     a1@(48),d0      | SX/SY
500
501         lea     GC_BASE,a0      | point to video control registers
502         movel   a6@(24),a0@(GCW_INTEN)          | intensity
503         movel   #0xff,a0@(GCW_PSEL)             | plane select
504         movel   #0x0e,a0@(GCW_CMD)              | write, 4x5, 1 of 20
505         tstl    a1@(16)
506         bne     ldraw4y_10
507         tstl    a1@(20)
508         bne     ldraw4y_10
509         movel   d3,a0@(GCW_PY)          | pixel Y addr
510         movel   d2,a0@(GCW_PX_SM)       | pixel X addr, start single mem
511         bra     ldraw4y_done
512 ldraw4y_10:
513         movel   d4,a0@(GCW_LG2)         | line gen, ND15-ND0
514         movel   d5,a0@(GCW_LG1)         | line gen, NB15-NB0
515         movel   d7,a0@(GCW_LG2)         | line gen, ND15-ND0
516         movel   d6,a0@(GCW_LG3)         | line-gen, NC11-NC0
517         movel   d0,a0@(GCW_LG4)         | line-gen, SX, SY, XMAJ
518         movel   d3,a0@(GCW_PY)          | pixel Y
519         movel   d2,a0@(GCW_PX_SL)       | pixel X, start line
520 ldraw4y_done:
521         addql   #1,d3           | y++
522         jra     ldraw4y_1
523 ldraw4y_11:
524         moveml  sp@+,d0-d7/a0-a2
525         unlk    a6
526         rts
527
528
529 | in-lined version of ldraw including y loop counter
530 | this version optimised for horizontal lines
531
532         .even
533 .globl  c_ldraw5y
534 c_ldraw5y:
535         link    a6,#0
536         moveml  d0-d7/a0-a2,sp@-
537         lea     gr_data,a1      | point to data space
538         lea     GC_BASE,a0      | base of video control registers
539         movel   a6@(24),a0@(GCW_INTEN)  | intensity
540         movel   #0xff,a0@(GCW_PSEL)     | plane select
541         movel   a6@(8),d2       | x1
542         movel   a6@(12),d3      | y1
543         movel   a6@(16),d1      | x2
544         movel   a6@(20),a2      | y2
545
546         subl    d2,d1           | (x2 - x1) -> d1
547         clrl    d4              | d4 = (2 * dy) = NA
548         clrl    d5              | d5 = (2 * dy) = NB
549         subl    d1,d4           | (2 * dy) - dx -> d4
550         subql   #1,d4           | d4 - SX -> d4
551         movel   d1,d6           | dx -> d6
552         movel   d5,d7           | dy -> d7
553         subl    d6,d7           | dy - dx -> d7
554         lsll    #1,d7           | shift left, d7 = ND
555
556 | by this point, d4 = ND, d5 = NB
557
558         subql   #1,d6           | d6 = NC
559         moveq   #7,d0           | SX, SY, XMAJ
560
561 | we are drawing a series of horizontal lines, all the same length
562 | so no need to re-calculate all the magic numbers each time
563
564 ldraw5y_1:
565         cmpl    d3,a2           | y1 <= y2
566         jge     ldraw5y_2
567         jra     ldraw5y_12
568 ldraw5y_2:
569         movel   #0x0e,a0@(GCW_CMD)      | write, 4x5, 1 of 20
570         tstl    d1                      | dx
571         bne     ldraw5y_10
572         movel   d3,a0@(GCW_PY)          | pixel Y addr
573         movel   d2,a0@(GCW_PX_SM)       | pixel X addr, start single mem
574         bra     ldraw5y_11
575 ldraw5y_10:
576         movel   d4,a0@(GCW_LG2)         | NA
577         movel   d5,a0@(GCW_LG1)         | NB
578         movel   d7,a0@(GCW_LG2)         | ND
579         movel   d6,a0@(GCW_LG3)         | NC
580         movel   d0,a0@(GCW_LG4)         | SX, SY, XMAJ
581         movel   d3,a0@(GCW_PY)          | pixel Y
582         movel   d2,a0@(GCW_PX_SL)       | pixel X, start line
583 ldraw5y_11:
584         addql   #1,d3                   | y++
585         jra     ldraw5y_1
586 ldraw5y_12:
587         moveml  sp@+,d0-d7/a0-a2
588         unlk    a6
589         rts
590
591 | in-lined version of ldraw including x loop counter
592 | this version optimised for vertical lines
593
594         .even
595 .globl  c_ldraw5x
596 c_ldraw5x:
597         link    a6,#0
598         moveml  d0-d7/a0-a2,sp@-
599         lea     gr_data,a1      | point to data space
600         lea     GC_BASE,a0      | base of video control registers
601         movel   a6@(24),a0@(GCW_INTEN)  | intensity
602         movel   #0xff,a0@(GCW_PSEL)     | plane select
603         movel   a6@(8),d2       | x1
604         movel   a6@(12),d3      | y1
605         movel   a6@(20),d1      | y2
606         movel   a6@(16),a2      | x2
607
608         subl    d3,d1           | (y2 - y1) -> d1
609         clrl    d4              | d4 = (2 * dx) = NA
610         clrl    d5              | d5 = (2 * dx) = NB
611         subl    d1,d4           | (2 * dx) - dy -> d4
612         subql   #1,d4           | d4 - SY -> d4
613         movel   d1,d6           | dy -> d6
614         movel   d5,d7           | dx -> d7
615         subl    d6,d7           | dx - dy -> d7
616         lsll    #1,d7           | shift left, d7 = ND
617
618 | by this point, d4 = ND, d5 = NB
619
620         subql   #1,d6           | d6 = NC
621         moveq   #6,d0           | SX, SY, XMAJ
622
623 | we are drawing a series of vertical lines, all the same length
624 | so no need to re-calculate all the magic numbers each time
625
626 ldraw5x_1:
627         cmpl    d2,a2           | x1 <= x2
628         jge     ldraw5x_2
629         jra     ldraw5x_12
630 ldraw5x_2:
631         movel   #0x0e,a0@(GCW_CMD)      | write, 4x5, 1 of 20
632         tstl    d1                      | dy
633         bne     ldraw5x_10
634         movel   d3,a0@(GCW_PY)          | pixel Y addr
635         movel   d2,a0@(GCW_PX_SM)       | pixel X addr, start single mem
636         bra     ldraw5x_11
637 ldraw5x_10:
638         movel   d4,a0@(GCW_LG2)         | NA
639         movel   d5,a0@(GCW_LG1)         | NB
640         movel   d7,a0@(GCW_LG2)         | ND
641         movel   d6,a0@(GCW_LG3)         | NC
642         movel   d0,a0@(GCW_LG4)         | SX, SY, XMAJ
643         movel   d3,a0@(GCW_PY)          | pixel Y
644         movel   d2,a0@(GCW_PX_SL)       | pixel X, start line
645 ldraw5x_11:
646         addql   #1,d2                   | x++
647         jra     ldraw5x_1
648 ldraw5x_12:
649         moveml  sp@+,d0-d7/a0-a2
650         unlk    a6
651         rts
652
653 | read 1 pixel from the screen, handle the bizarre layout
654
655         .even
656 .globl  r1pix3
657 r1pix3:
658         link    a6,#0
659         moveml  d1-d5/a0,sp@-
660         movew   #1023,d5
661         subw    a6@(14),d5      | d5 is y as 16-bit value
662         movew   d5,d4
663         andib   #0xfc,d4        | d4 is y0
664         movew   #3,d0
665         andw    d5,d0           | y & 3
666         movel   #3,d3           | ensure top word is clear
667         subw    d0,d3           | 3 - (y & 3)
668         aslw    #3,d3           | << 3
669         movel   a6@(8),d0       | x
670         divuw   #20,d0          | x % 20
671         clrw    d0              | clear quotient
672         swap    d0              | put remainder in lower 16 bits
673         divuw   #5,d0           | (x % 20) / 5
674         aslw    #3,d0           | << 3
675         addw    d0,d3           | ys in d3
676         movew   #24,d0
677         cmpw    d3,d0
678         jge     r1pix3_1
679         movew   #-32,d0
680         addw    d0,d3
681 r1pix3_1:
682         lea     GC_BASE,a0              | base of video control registers
683         movel   a6@(16),a0@(GCW_PSEL)   | plane select mask
684         movel   #0x07,a0@(GCW_LG4)
685         movel   #0x66,a0@(GCW_CMD)
686         movel   a6@(8),a0@(GCW_PX)      | x
687         movel   d4,a0@(GCW_PY)          | y
688         movel   a0@(GCR_IN_SM),d0       | read intensity, start single mem cycle
689         movel   a0@(GCR_IN_SM),d0
690         movel   d0,d1
691         moveq   #0,d0
692         notb    d0              | d0 = 0xff
693         asll    d3,d0           | << fs
694         andl    d1,d0           | (ic & (0xff << fs)
695         asrl    d3,d0           | >> ys
696         andl    #0xff,d0
697         moveml  sp@+,d1-d5/a0
698         unlk    a6
699         rts
700
701 | read a rectangular array of pixels from the screen
702 | void rd_rect(int x1, int y1, int x2, int y2, char *buf)
703
704         .even
705 .globl  rd_rect2
706 rd_rect2:
707         link    a6,#0
708         moveml  d1-d7/a0-a1,sp@-
709         movel   #1023,d7
710         subl    a6@(20),d7      | d7 is y2 as 16-bit value
711         movel   d7,a6@(20)
712         movel   #1023,d6
713         subl    a6@(12),d6      | d6 is y1 as 16-bit value
714         movel   d6,a6@(12)
715         movel   a6@(8),d5       | d5 is x
716         lea     GC_BASE,a0      | base of video control registers
717         movel   a6@(24),a1      | buf
718 rd_rect2_1:
719         cmpw    a6@(18),d5      | x < x2
720         jlt     rd_rect2_2
721         jra     rd_rect2_8
722 rd_rect2_2:
723         movel   d5,d4           | d4 is xs
724         divuw   #20,d4          | x % 20
725         clrw    d4              | clear quotient
726         swap    d4              | remainder in lower word
727         divuw   #5,d4           | (x % 20) / 5
728         aslw    #3,d4           | ((x % 20) / 5) << 3
729 rd_rect2_3:
730         cmpw    d7,d6           | y > y2
731         jgt     rd_rect2_4
732         jra     rd_rect2_7
733 rd_rect2_4:
734         movel   d6,d3           | d3 is y0
735         andib   #0xfc,d3        | y & 0xfffc
736         moveq   #3,d0
737         andw    d6,d0           | y & 3
738         moveq   #3,d2           | ensure top word is clear
739         subw    d0,d2           | 3 - (y & 3)
740         aslw    #3,d2           | << 3
741         addw    d4,d2           | ys in d2
742         moveq   #24,d0
743         cmpw    d2,d0
744         jge     rd_rect2_5
745         movew   #-32,d0
746         addw    d0,d2
747 rd_rect2_5:
748         movel   #0xff,a0@(GCW_PSEL)     | plane select mask
749         movel   #0x07,a0@(GCW_LG4)
750         movel   #0x66,a0@(GCW_CMD)
751         movel   d5,a0@(GCW_PX)          | x
752         movel   d3,a0@(GCW_PY)          | y0
753         movel   a0@(GCR_IN_SM),d1       | read intensity, start single mem cycle
754         movel   a0@(GCR_IN_SM),d1
755         moveq   #0,d0
756         notb    d0              | d0 = 0xff
757         asll    d2,d0           | << fs
758         andl    d1,d0           | (ic & (0xff << fs)
759         asrl    d2,d0           | >> ys
760         andl    #0xff,d0
761         moveb   d0,a1@+         | *buf++
762 rd_rect2_6:
763         subqw   #1,d6           | y--
764         jra     rd_rect2_3
765 rd_rect2_7:
766         addqw   #1,d5           | x++
767         movel   a6@(12),d6      | y = y1
768         jra     rd_rect2_1
769 rd_rect2_8:
770         moveml  sp@+,d1-d7/a0-a1
771         unlk    a6
772         rts
773
774
775 | write a rectangular array of pixels to the screen
776 | void wr_rect(int x1, int y1, int x2, int y2, char *buf)
777
778         .even
779 .globl  wr_rect2
780 wr_rect2:
781         link    a6,#0
782         moveml  d1-d7/a0-a1,sp@-
783         movel   #1023,d7
784         subl    a6@(20),d7      | d7 is y2 as 16-bit value
785         movel   d7,a6@(20)
786         movel   #1023,d6
787         subl    a6@(12),d6      | d6 is y1 as 16-bit value
788         movel   d6,a6@(12)
789         movel   a6@(8),d5       | d5 is x
790         lea     GC_BASE,a0      | base of video control registers
791         movel   a6@(24),a1      | buf
792 wr_rect2_1:
793         cmpw    a6@(18),d5      | x < x2
794         jlt     wr_rect2_2
795         jra     wr_rect2_8
796 wr_rect2_2:
797         movel   d5,d4           | d4 is xs
798         divuw   #20,d4          | x % 20
799         clrw    d4              | clear quotient
800         swap    d4              | remainder in lower word
801         divuw   #5,d4           | (x % 20) / 5
802         aslw    #3,d4           | ((x % 20) / 5) << 3
803 wr_rect2_3:
804         cmpw    d7,d6           | y > y2
805         jgt     wr_rect2_4
806         jra     wr_rect2_7
807 wr_rect2_4:
808         movel   d6,d3           | d3 is y0
809         andib   #0xfc,d3        | y & 0xfffc
810         movel   #0xff,a0@(GCW_PSEL)     | plane select mask
811         movel   #0x07,a0@(GCW_LG4)
812         movel   #0x66,a0@(GCW_CMD)
813         movel   d5,a0@(GCW_PX)          | x
814         movel   d3,a0@(GCW_PY)          | y0
815         movel   a0@(GCR_IN_SM),d1       | read intensity, start single mem cycle
816         movel   a0@(GCR_IN_SM),d1       | d1 is ic
817         moveq   #3,d0
818         andw    d6,d0           | y & 3
819         moveq   #3,d2           | ensure top word is clear
820         subw    d0,d2           | 3 - (y & 3)
821         aslw    #3,d2           | << 3
822         addw    d4,d2           | ys in d2
823         moveq   #24,d0
824         cmpw    d2,d0
825         jge     wr_rect2_5
826         movew   #-32,d0
827         addw    d0,d2
828 wr_rect2_5:
829         moveq   #0,d0
830         notb    d0              | d0 = 0xff
831         asll    d2,d0           | <<fs
832         notl    d0              | invert
833         andl    d1,d0           | (ic & (0cff << ys))
834         clrl    d1
835         moveb   a1@+,d1         | *buf++
836         asll    d2,d1           | << ys
837         orl     d1,d0
838         movel   #0xff,a0@(GCW_PSEL)     | plane select mask
839         movel   #0x07,a0@(GCW_LG4)
840         movel   #0x6e,a0@(GCW_CMD)
841         movel   d5,a0@(GCW_PX)          | x
842         movel   d3,a0@(GCW_PY)          | y0
843         movel   d0,a0@(GCW_IN_SM)       | write inten, start single mem cycle
844 wr_rect2_6:
845         subqw   #1,d6           | y--
846         jra     wr_rect2_3
847 wr_rect2_7:
848         addqw   #1,d5           | x++
849         movel   a6@(12),d6      | y = y1
850         jra     wr_rect2_1
851 wr_rect2_8:
852         moveml  sp@+,d1-d7/a0-a1
853         unlk    a6
854         rts
855
856 | write a rectangular array of pixels to the screen
857 | void wr_rect4(int x1, int y1, int x2, int y2, char *buf)
858 |
859 | This version writes the block with the x axis as the inner loop,
860 | this is slower than wr_rect2() but is necessary for the VNC
861 | CopyDataToScreen() function.
862
863         .even
864 .globl  wr_rect4
865 wr_rect4:
866         link    a6,#0
867         moveml  d1-d7/a0-a1,sp@-
868         movel   #1023,d7
869         subl    a6@(20),d7      | d7 is y2 as 16-bit value
870         movel   d7,a6@(20)
871         movel   #1023,d6
872         subl    a6@(12),d6      | d6 is y1 as 16-bit value
873         movel   d6,a6@(12)
874         movel   a6@(8),d5       | d5 is x
875         lea     GC_BASE,a0      | base of video control registers
876         movel   a6@(24),a1      | buf
877 wr_rect4_1:
878         cmpw    d7,d6           | y > y2
879         jgt     wr_rect4_2
880         jra     wr_rect4_8
881 wr_rect4_2:
882         movel   d6,d3           | d3 is y0
883         andib   #0xfc,d3        | y & 0xfffc
884         moveq   #3,d0
885         andw    d6,d0           | y & 3
886         moveq   #3,d2           | ensure top word is clear
887         subw    d0,d2           | 3 - (y & 3)
888         aslw    #3,d2           | << 3
889 wr_rect4_3:
890         cmpw    a6@(18),d5      | x < x2
891         jlt     wr_rect4_4
892         jra     wr_rect4_7
893 wr_rect4_4:
894         movel   #0xff,a0@(GCW_PSEL)     | plane select mask
895         movel   #0x07,a0@(GCW_LG4)
896         movel   #0x66,a0@(GCW_CMD)
897         movel   d5,a0@(GCW_PX)          | x
898         movel   d3,a0@(GCW_PY)          | y0
899         movel   a0@(GCR_IN_SM),d1       | read intensity, start single mem cycle
900         movel   a0@(GCR_IN_SM),d1       | d1 is ic
901         movel   d5,d4           | d4 is xs
902         divuw   #20,d4          | x % 20
903         clrw    d4              | clear quotient
904         swap    d4              | remainder in lower word
905         divuw   #5,d4           | (x % 20) / 5
906         aslw    #3,d4           | ((x % 20) / 5) << 3
907         addw    d2,d4           | ys in d2, xs in d4
908         moveq   #24,d0
909         cmpw    d4,d0
910         jge     wr_rect4_5
911         movew   #-32,d0
912         addw    d0,d4
913 wr_rect4_5:
914         moveq   #0,d0
915         notb    d0              | d0 = 0xff
916         asll    d4,d0           | <<fs
917         notl    d0              | invert
918         andl    d1,d0           | (ic & (0cff << ys))
919         clrl    d1
920         moveb   a1@+,d1         | *buf++
921         asll    d4,d1           | << ys
922         orl     d1,d0
923         movel   #0xff,a0@(GCW_PSEL)     | plane select mask
924         movel   #0x07,a0@(GCW_LG4)
925         movel   #0x6e,a0@(GCW_CMD)
926         movel   d5,a0@(GCW_PX)          | x
927         movel   d3,a0@(GCW_PY)          | y0
928         movel   d0,a0@(GCW_IN_SM)       | write inten, start single mem cycle
929 wr_rect4_6:
930         addqw   #1,d5           | x++
931         jra     wr_rect4_3
932 wr_rect4_7:
933         subqw   #1,d6           | y--
934         movel   a6@(8),d5       | x = x1
935         jra     wr_rect4_1
936 wr_rect4_8:
937         moveml  sp@+,d1-d7/a0-a1
938         unlk    a6
939         rts
940
941 | write a rectangular array of pixels to the screen
942 | void wr_rect5(int x1, int y1, int x2, int y2, char *buf)
943 |
944 | This version writes the block with the x axis as the inner loop,
945 | this is slower than wr_rect2() but is necessary for the VNC
946 | CopyDataToScreen() function.
947 |
948 | This version uses a lookup table for the pixel mask and shift count.
949 | This removes one of the divide instructions (divides are slow).
950
951         .even
952 .globl  wr_rect5
953 wr_rect5:
954         link    a6,#0
955         moveml  d1-d7/a0-a2,sp@-
956         movel   #1023,d7
957         subl    a6@(20),d7      | d7 is y2
958         movel   #1023,d6
959         subl    a6@(12),d6      | d6 is y1
960         movel   a6@(8),d5       | d5 is x
961         lea     GC_BASE,a0      | base of video control registers
962         movel   a6@(24),a1      | buf
963         lea     pm_tab,a2       | base of lookup table
964         movel   #0xff,a0@(GCW_PSEL)     | plane select mask
965 wr_rect5_1:
966         cmpl    d7,d6           | y > y2
967         jle     wr_rect5_8
968         movel   d6,d3           | d3 is y0
969         andib   #0xfc,d3        | y & 0xfffc
970         moveq   #3,d2
971         andl    d6,d2           | y & 3
972         asll    #3,d2           | (y & 3) * 8
973 wr_rect5_3:
974         cmpl    a6@(16),d5      | x < x2
975         jge     wr_rect5_7
976         movel   #0x07,a0@(GCW_LG4)
977         movel   #0x66,a0@(GCW_CMD)
978         movel   d5,a0@(GCW_PX)          | x
979         movel   d3,a0@(GCW_PY)          | y0
980         movel   a0@(GCR_IN_SM),d1       | read intensity, start single mem cycle
981         movel   a0@(GCR_IN_SM),d1       | d1 is ic
982         movel   d5,d4           | d4 is xs
983         divuw   #20,d4          | x % 20
984         clrw    d4              | clear quotient
985         swap    d4              | remainder in lower word
986         asll    #5,d4           | *32
987         addl    d2,d4           | ((x % 20) * 32) + ((y % 4) * 8)
988         movel   a2@(d4:w:1),d0  | fetch mask
989         andl    d1,d0           | (ic & mask)
990 |       andl    a2@(d4:w:1),d0  | (ic & mask)
991         clrl    d1
992         moveb   a1@+,d1         | *buf++
993         addql   #4,d4
994         movel   a2@(d4:w:1),d4  | fetch shift count
995         asll    d4,d1           | << ys
996         orl     d1,d0
997         movel   #0x07,a0@(GCW_LG4)
998         movel   #0x6e,a0@(GCW_CMD)
999         movel   d5,a0@(GCW_PX)          | x
1000         movel   d3,a0@(GCW_PY)          | y0
1001         movel   d0,a0@(GCW_IN_SM)       | write inten, start single mem cycle
1002 wr_rect5_6:
1003         addql   #1,d5           | x++
1004         jra     wr_rect5_3
1005 wr_rect5_7:
1006         subql   #1,d6           | y--
1007         movel   a6@(8),d5       | x = x1
1008         jra     wr_rect5_1
1009 wr_rect5_8:
1010         moveml  sp@+,d1-d7/a0-a2
1011         unlk    a6
1012         rts
1013
1014 | write 1 pixel to the screen, handle the bizarre layout
1015
1016         .even
1017 .globl  w1pix3
1018 w1pix3:
1019         link    a6,#0
1020         moveml  d1-d5/a0,sp@-
1021         movew   #1023,d5
1022         subw    a6@(14),d5      | d5 is y as 16-bit value
1023         movew   d5,d4
1024         andib   #0xfc,d4        | d4 is y0
1025         lea     GC_BASE,a0              | base of video control registers
1026         movel   a6@(16),a0@(GCW_PSEL)   | plane select mask
1027         movel   #0x07,a0@(GCW_LG4)
1028         movel   #0x66,a0@(GCW_CMD)
1029         movel   a6@(8),a0@(GCW_PX)      | x
1030         movel   d4,a0@(GCW_PY)          | y0
1031         movel   a0@(GCR_IN_SM),d0       | read intensity, start single mem cycle
1032         movel   a0@(GCR_IN_SM),d0       | 4 pixels in d0
1033         movel   d0,d3           | ic in d3
1034         movew   #3,d0
1035         andw    d5,d0           | y & 3
1036         movel   #3,d2           | ensure top word is clear
1037         subw    d0,d2           | 3 - (y & 3)
1038         aslw    #3,d2           | << 3
1039         movel   a6@(8),d0       | x
1040         divuw   #20,d0          | x % 20
1041         clrw    d0              | clear quotient
1042         swap    d0              | put remainder in lower 16 bits
1043         divuw   #5,d0           | (x % 20) / 5
1044         aslw    #3,d0           | << 3
1045         addw    d0,d2           | ys in d2
1046         movew   #24,d0
1047         cmpw    d2,d0
1048         jge     w1pix3_1
1049         movew   #-32,d0
1050         addw    d0,d2
1051 w1pix3_1:
1052         moveq   #0,d0
1053         notb    d0              | d0 = 0xff
1054         asll    d2,d0           | << ys
1055         notl    d0              | invert
1056         andl    d3,d0           | (ic & (0xff << ys)
1057         movel   a6@(20),d1      | i
1058         asll    d2,d1           | i << ys
1059         orl     d1,d0
1060         movel   a6@(16),a0@(GCW_PSEL)   | plane select mask
1061         movel   #0x07,a0@(GCW_LG4)
1062         movel   #0x6e,a0@(GCW_CMD)
1063         movel   a6@(8),a0@(GCW_PX)      | x
1064         movel   d4,a0@(GCW_PY)          | y0
1065         movel   d0,a0@(GCW_IN_SM)       | write inten, start single mem cycle
1066         moveml  sp@+,d1-d5/a0
1067         unlk    a6
1068         rts
1069
1070 | data
1071
1072         .data
1073
1074 | lookup table for wr_rect5()
1075 | this gives the pixel mask and shift count to locate each pixel in 
1076 | the 4 x 20 array pattern used by the Prisma video board
1077
1078 pm_tab:         .long   0x00ffffff, 24  |  0,0
1079                 .long   0xff00ffff, 16  |  0,1
1080                 .long   0xffff00ff,  8  |  0,2
1081                 .long   0xffffff00,  0  |  0,3
1082                 .long   0x00ffffff, 24  |  1,0
1083                 .long   0xff00ffff, 16  |  1,1
1084                 .long   0xffff00ff,  8  |  1,2
1085                 .long   0xffffff00,  0  |  1,3
1086                 .long   0x00ffffff, 24  |  2,0
1087                 .long   0xff00ffff, 16  |  2,1
1088                 .long   0xffff00ff,  8  |  2,2
1089                 .long   0xffffff00,  0  |  2,3
1090                 .long   0x00ffffff, 24  |  3,0
1091                 .long   0xff00ffff, 16  |  3,1
1092                 .long   0xffff00ff,  8  |  3,2
1093                 .long   0xffffff00,  0  |  3,3
1094                 .long   0x00ffffff, 24  |  4,0
1095                 .long   0xff00ffff, 16  |  4,1
1096                 .long   0xffff00ff,  8  |  4,2
1097                 .long   0xffffff00,  0  |  4,3
1098                 .long   0xffffff00,  0  |  5,0
1099                 .long   0x00ffffff, 24  |  5,1
1100                 .long   0xff00ffff, 16  |  5,2
1101                 .long   0xffff00ff,  8  |  5,3
1102                 .long   0xffffff00,  0  |  6,0
1103                 .long   0x00ffffff, 24  |  6,1
1104                 .long   0xff00ffff, 16  |  6,2
1105                 .long   0xffff00ff,  8  |  6,3
1106                 .long   0xffffff00,  0  |  7,0
1107                 .long   0x00ffffff, 24  |  7,1
1108                 .long   0xff00ffff, 16  |  7,2
1109                 .long   0xffff00ff,  8  |  7,3
1110                 .long   0xffffff00,  0  |  8,0
1111                 .long   0x00ffffff, 24  |  8,1
1112                 .long   0xff00ffff, 16  |  8,2
1113                 .long   0xffff00ff,  8  |  8,3
1114                 .long   0xffffff00,  0  |  9,0
1115                 .long   0x00ffffff, 24  |  9,1
1116                 .long   0xff00ffff, 16  |  9,2
1117                 .long   0xffff00ff,  8  |  9,3
1118                 .long   0xffff00ff,  8  | 10,0
1119                 .long   0xffffff00,  0  | 10,1
1120                 .long   0x00ffffff, 24  | 10,2
1121                 .long   0xff00ffff, 16  | 10,3
1122                 .long   0xffff00ff,  8  | 11,0
1123                 .long   0xffffff00,  0  | 11,1
1124                 .long   0x00ffffff, 24  | 11,2
1125                 .long   0xff00ffff, 16  | 11,3
1126                 .long   0xffff00ff,  8  | 12,0
1127                 .long   0xffffff00,  0  | 12,1
1128                 .long   0x00ffffff, 24  | 12,2
1129                 .long   0xff00ffff, 16  | 12,3
1130                 .long   0xffff00ff,  8  | 13,0
1131                 .long   0xffffff00,  0  | 13,1
1132                 .long   0x00ffffff, 24  | 13,2
1133                 .long   0xff00ffff, 16  | 13,3
1134                 .long   0xffff00ff,  8  | 14,0
1135                 .long   0xffffff00,  0  | 14,1
1136                 .long   0x00ffffff, 24  | 14,2
1137                 .long   0xff00ffff, 16  | 14,3
1138                 .long   0xff00ffff, 16  | 15,0
1139                 .long   0xffff00ff,  8  | 15,1
1140                 .long   0xffffff00,  0  | 15,2
1141                 .long   0x00ffffff, 24  | 15,3
1142                 .long   0xff00ffff, 16  | 16,0
1143                 .long   0xffff00ff,  8  | 16,1
1144                 .long   0xffffff00,  0  | 16,2
1145                 .long   0x00ffffff, 24  | 16,3
1146                 .long   0xff00ffff, 16  | 17,0
1147                 .long   0xffff00ff,  8  | 17,1
1148                 .long   0xffffff00,  0  | 17,2
1149                 .long   0x00ffffff, 24  | 17,3
1150                 .long   0xff00ffff, 16  | 18,0
1151                 .long   0xffff00ff,  8  | 18,1
1152                 .long   0xffffff00,  0  | 18,2
1153                 .long   0x00ffffff, 24  | 18,3
1154                 .long   0xff00ffff, 16  | 19,0
1155                 .long   0xffff00ff,  8  | 19,1
1156                 .long   0xffffff00,  0  | 19,2
1157                 .long   0x00ffffff, 24  | 19,3
1158
1159
1160 | temporary storage for line drawing routine
1161
1162 gr_data:
1163 line_x1:        .long   0       |  0 (668)
1164 line_y1:        .long   0       |  4 (66c)
1165 line_x2:        .long   0       |  8 (670)
1166 line_y2:        .long   0       | 12 (674)
1167                 .long   0       | 16 (678)
1168                 .long   0       | 20 (67c)
1169                 .long   0       | 24 (680)
1170                 .long   0       | 28 (684)
1171                 .long   0       | 32 (688)
1172                 .long   0       | 36 (68c)
1173 line_xdir:      .long   0       | 40 (690)
1174 line_ydir:      .long   0       | 44 (694)
1175                 .long   0       | 48 (698)
1176 line_selmask:   .long   0       | 52 (69c)
1177 line_inten:     .long   0       | 56 (6A0)
1178 line_flag:      .word   0       | 60 (6a4)
1179 init_flag1:     .word   0       | 62 (6a6)
1180                 .long   0       | 64 (6a8)
1181                 .long   0       | 64 (6ac)
1182 init_flag4:     .long   0       | 64 (6b0)
1183                 .long   0       | 64 (6b4)
1184                 .long   0       | 64 (6b8)
1185                 .long   0       | 64 (6bc)
1186                 .long   0       | 64 (6c0)
1187                 .long   0       | 64 (6c4)
1188                 .long   0       | 64 (6c8)
1189                 .long   0       | 64 (6cc)
1190                 .long   0       | 64 (6d0)
1191                 .long   0       | 64 (6d4)
1192                 .long   0       | 64 (6d8)
1193                 .long   0       | 64 (6dc)
1194                 .long   0       | 64 (6e0)
1195                 .long   0       | 64 (6e4)
1196                 .long   0       | 64 (6e8)
1197                 .long   0       | 64 (6ec)
1198 init_flag6:     .long   0       | 64 (6f0)
1199 init_flag5:     .word   0       | 64 (6f4)
1200 init_flag2:     .word   0       | 64 (6f6)
1201 init_flag3:     .word   0       | 64 (6f8)
1202
1203