annotate 3rdparty/utils/view/view_gifpix.a @ 1777:b7fb6a9aead4

Removed /dd/defs so that rma could assemble
author boisy
date Sat, 02 Apr 2005 14:10:41 +0000
parents 6b23465701c0
children 37fd74e6fad8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1706
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
1 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
2 * Setup and Screen support for GIF
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
3 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
4 * Globals
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
5 * gifoutinit -- Initialize output machinery
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
6 * gifoutpix -- output one pixel, with scaling, etc.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
7 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
8 ifp1
1777
b7fb6a9aead4 Removed /dd/defs so that rma could assemble
boisy
parents: 1706
diff changeset
9 use os9defs.a
1706
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
10 endc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
11
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
12 psect view_gifpix_a,0,0,0,0,0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
13
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
14 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
15 * Screen support-- output one GIF pixel to screen, with scaling and dithering.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
16 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
17 vsect dp
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
18 pixpline rmb 2 Number of pixels on a virtual screen line.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
19 pixscrn rmb 2 Number of pixels on actual screen line.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
20 pixcnt rmb 2 Count of pixels on actual screen line.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
21 lineptr rmb 2 Pointer to linebuff, for putting pixels
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
22 pixleft rmb 2 Number of pixels left for this GIF line
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
23 horscale rmb 2 Horizontal scaling counter.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
24 linecount rmb 2 Current GIF line number
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
25 linenumb rmb 2 Current Coco Line number
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
26 linemax rmb 2 Max Coco line number
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
27 lineinc rmb 2 Increment between lines
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
28 verscale rmb 2 vertical scaling counter.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
29 endsect
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
30
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
31 * gifinterlace holds T if we do interlace.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
32 gifoutinit:
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
33 pshs d,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
34 ldd #1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
35 tst <gifinterlace
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
36 beq init1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
37 ldd #8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
38 init1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
39 std lineinc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
40
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
41 ldd #0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
42 std linecount
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
43 std horscale
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
44 std verscale
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
45
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
46 ldd <Skipcols
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
47 bpl init20 Default value is zero
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
48 ldd #0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
49 std <Skipcols
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
50 init20
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
51
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
52 ldd <Skiplines
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
53 bpl init21 Default value is zero
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
54 ldd #0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
55 std <Skiplines
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
56 init21
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
57
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
58 ldd #0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
59 subd <Skipcols
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
60 std pixcnt
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
61
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
62 leax linebuff,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
63 stx lineptr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
64 ldd <gifiwidth
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
65 std pixleft
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
66
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
67 ldx #320 Type 8 and 6 screens are 320 pixels across.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
68 lda <type
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
69 cmpa #8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
70 beq init8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
71 cmpa #6
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
72 beq init8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
73 ldx #640 Type 7 and 5 are 640 pixels across.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
74 init8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
75 stx pixscrn
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
76 stx pixpline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
77
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
78 ldd #192 For default size, scale pic to 192 lines.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
79 std linemax
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
80
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
81 lda <Size
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
82 bne init98
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
83 ldx <gifiheight For small, choose divisor of actual height.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
84 clra
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
85 pshs a
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
86 init92
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
87 inc ,s
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
88 lda ,s
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
89 lbsr div168 Divide height by number
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
90 cmpd #200
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
91 bhi init92 If not <200, keep going
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
92 std linemax
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
93 puls a Clear stack
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
94 bra init99
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
95 init98
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
96 cmpa #2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
97 bne init99
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
98 ldd <gifiheight Huge is 1:1 height
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
99 std linemax
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
100 ldd <gifiwidth And 1:1 width
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
101 cmpd <pixscrn ... but not less than screen width
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
102 blo init99
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
103 std pixpline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
104 init99
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
105
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
106 puls d,x,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
107
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
108 * Output pixel to screen
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
109 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
110 * Expects
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
111 * alt2buff holds color translation table
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
112 * A holds pixel to output
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
113 * gifiheight, gifiwidth hold picture dimensions
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
114 gifoutpix:
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
115 pshs a,b,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
116 tst verscale
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
117 bmi outpix5
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
118 ldx lineptr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
119 ldd horscale
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
120 subd pixpline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
121 std horscale
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
122 bpl outpix5
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
123 outpix1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
124 ldd pixcnt
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
125 addd #1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
126 std pixcnt
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
127 bmi outpix11
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
128 cmpd pixscrn
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
129 bgt outpix11
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
130 lda ,s
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
131 sta ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
132 outpix11
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
133 ldd horscale
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
134 addd <gifiwidth
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
135 std horscale
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
136 bmi outpix1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
137 stx lineptr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
138 outpix5
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
139 ldx pixleft Count down number of GIF pixels on this line.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
140 leax -1,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
141 stx pixleft
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
142 bne outpix9
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
143 tst verscale
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
144 bmi outpix7
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
145 lbsr dithline Translate GIF pixels to CoCo colors
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
146 lbsr convline Convert the pixels to bytes.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
147 lbsr outline If we're done, output the line.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
148 lbsr clrline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
149 outpix7
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
150 lbsr setline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
151 leax linebuff,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
152 stx lineptr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
153 ldx <gifiwidth
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
154 stx pixleft
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
155 ldx #00
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
156 stx horscale
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
157
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
158 ldd #0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
159 subd <Skipcols
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
160 std pixcnt
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
161 outpix9
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
162 puls a,b,x,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
163
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
164 dithline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
165 pshs a,b,x,y,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
166 leau alt2buff,y Color mapping table.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
167 ldd pixscrn Number of pixels on this line.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
168 lsra Divide by 4, since main loop does 4 pixels at a time.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
169 rorb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
170 lsra
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
171 rorb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
172 pshs b Even for a 640-pixel line, this will be less than 256.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
173 leay linebuff,y Y points to line data.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
174
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
175 lda linenumb+1 What line (mod 4) are we on?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
176 anda #3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
177 leax dithtable,pcr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
178 leax a,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
179 jsr a,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
180 puls b
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
181 puls a,b,x,y,u,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
182
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
183 dithtable
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
184 bra dithloop1 Different sub for each line (mod 4).
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
185 bra dithloop2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
186 bra dithloop3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
187 bra dithloop4
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
188
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
189 dithloop1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
190 bsr dofastdith
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
191 ldb #$60
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
192 bsr dodither
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
193 bsr dofastdith
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
194 ldb #$40
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
195 bsr dodither
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
196 dec 3,s
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
197 bne dithloop1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
198 rts
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
199
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
200 dithloop2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
201 ldb #$20
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
202 bsr dodither
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
203 bsr dofastdith
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
204 ldb #$00
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
205 bsr dodither
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
206 bsr dofastdith
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
207 dec 3,s
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
208 bne dithloop2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
209 rts
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
210
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
211 dithloop3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
212 bsr dofastdith
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
213 ldb #$50
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
214 bsr dodither
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
215 bsr dofastdither
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
216 ldb #$70
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
217 bsr dodither
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
218 dec 3,s
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
219 bne dithloop3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
220 rts
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
221
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
222 dithloop4
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
223 ldb #$10
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
224 bsr dodither
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
225 bsr dofastdith
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
226 ldb #$30
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
227 bsr dodither
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
228 bsr dofastdith
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
229 dec 3,s
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
230 bne dithloop4
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
231 rts
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
232
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
233 * Dither one pixel. Get GIF color from ,y and convert it into primary
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
234 * color iff B is above the threshold value.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
235 dodither
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
236 pshs b
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
237 ldb ,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
238 clra
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
239 leax d,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
240 abx
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
241 abx
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
242 lda ,x Get primary color.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
243 puls b
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
244 cmpb 2,x Are we above the threshold?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
245 bhs dodither1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
246 lda 1,x If not, choose secondary color.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
247 dodither1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
248 anda #$0f
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
249 sta ,y+ Store the color.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
250 rts
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
251
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
252 * Since every other pixel is gauranteed to be a primary color, it seems
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
253 * worthwhile to have a faster version of the dither sub for that case.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
254 dofastdith
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
255 ldb ,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
256 clra
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
257 leax d,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
258 abx
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
259 lda d,x Get primary color.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
260 anda #$0f
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
261 sta ,y+ Store the color.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
262 rts
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
263
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
264 convline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
265 pshs a,b,x,y,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
266 lda <type
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
267 cmpa #8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
268 bne conv4no
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
269 bsr conv4line Type 8 screen has 4 bits/pixel
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
270 bra conv10
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
271 conv4no
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
272 cmpa #7
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
273 beq conv2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
274 cmpa #6
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
275 bne conv2no
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
276 conv2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
277 bsr conv2line type 7,6 are 2 bits/pix
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
278 bra conv10
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
279 conv2no
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
280 bsr conv1line type 5 is 1 bit/pix
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
281 conv10
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
282 puls a,b,x,y,u,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
283
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
284 conv4table fcb $00,$10,$20,$30,$40,$50,$60,$70,$80,$90,$a0,$b0,$c0,$d0,$e0,$f0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
285 conv4line
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
286 leax linebuff,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
287 tfr x,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
288 leay conv4table,pcr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
289 ldb #160
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
290 pshs b
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
291 conv4loop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
292 lda ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
293 ldb ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
294 orb a,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
295 stb ,u+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
296 dec ,s
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
297 bne conv4loop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
298 puls b
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
299 rts
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
300
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
301 conv2table fcb $00,$40,$80,$c0,$00,$10,$20,$30,$00,$04,$08,$0c
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
302 conv2line
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
303 leax linebuff,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
304 tfr x,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
305 leay conv2table,pcr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
306 ldd pixscrn
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
307 lsra
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
308 rorb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
309 lsra
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
310 rorb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
311 pshs b
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
312 conv2loop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
313 lda ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
314 lda a,y Convert 1st pixel in byte.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
315 ldb ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
316 addb #4
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
317 ora b,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
318 ldb ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
319 addb #8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
320 ora b,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
321 ora ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
322 sta ,u+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
323 dec ,s
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
324 bne conv2loop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
325 puls b
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
326 rts
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
327
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
328 conv1line
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
329 leax linebuff,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
330 tfr x,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
331 ldy #80
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
332 conv1loop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
333 ldb #$80
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
334 pshs b
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
335 clra
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
336 conv10loop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
337 tst ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
338 beq conv11
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
339 ora ,s
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
340 conv11
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
341 ror ,s
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
342 bne conv10loop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
343 puls b
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
344 sta ,u+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
345 leay -1,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
346 bne conv1loop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
347 rts
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
348
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
349 clrline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
350 pshs a,b,x,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
351 leax linebuff,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
352 ldy pixscrn
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
353 clra
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
354 clrline1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
355 sta ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
356 leay -1,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
357 bne clrline1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
358 puls a,b,x,y,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
359
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
360 nextline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
361 pshs d,x,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
362 ldx lineinc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
363 beq nextline9
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
364 ldd verscale
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
365 nextline1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
366 tsta Actually, test sign of D
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
367 bmi nextline2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
368 subd <gifiheight If it's positive, that's another screen line.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
369 ldu linenumb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
370 leau 1,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
371 stu linenumb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
372 bra nextline1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
373 nextline2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
374 addd linemax
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
375 ldu linecount That's another gif line.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
376 leau 1,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
377 stu linecount
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
378 leax -1,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
379 bne nextline1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
380 std verscale
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
381 nextline9
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
382 puls d,x,u,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
383
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
384 setline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
385 pshs a,b,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
386 bsr nextline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
387 ldd linecount
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
388 cmpd <gifiheight
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
389 blo setline5
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
390 andb #$7
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
391 beq setline3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
392 ldd lineinc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
393 lsrb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
394 std lineinc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
395 setline3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
396 ldd #0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
397 std linecount
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
398 std linenumb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
399 std verscale
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
400 ldd lineinc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
401 lsrb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
402 clra
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
403 std lineinc Start off by moving 1/2 of the increment
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
404 bsr nextline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
405 lslb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
406 std lineinc Now, set the increment right.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
407 setline5
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
408 puls a,b,x,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
409
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
410 outline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
411 pshs a,b,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
412 ldd linenumb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
413 subd <Skiplines
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
414 bmi outline1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
415 cmpd #192
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
416 bhs outline1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
417 lbsr putline Put the line onto the screen
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
418 outline1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
419 puls a,b,x,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
420
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
421 endsect