1706
|
1 *****************************************************************************
|
|
2 * *
|
|
3 * SUBS for vef picture format *
|
|
4 * *
|
|
5 * VEFshowpic -- Displays picture, using putline routine *
|
|
6 * *
|
|
7 *****************************************************************************
|
|
8
|
|
9 check macro
|
|
10 pshs b,cc
|
|
11 ldb #\1
|
|
12 os9 F$PErr
|
|
13 puls b,cc
|
|
14 endm
|
|
15
|
|
16 ifp1
|
1912
|
17 use os9defs.d
|
1706
|
18 endc
|
|
19
|
|
20 psect view_vef_a,0,0,0,0,0
|
|
21
|
|
22 vsect dp
|
|
23 linesize rmb 2
|
|
24 endofpic rmb 1
|
|
25 VEFtype rmb 1
|
|
26 numpics rmb 1 Total number of pictures to load.
|
|
27 endsect
|
|
28
|
|
29 SetVF:
|
|
30 tst <format
|
|
31 bne SetVF1
|
|
32 sta numpics Set total number of pictures.
|
|
33 lda #VEFFormat
|
|
34 sta <format
|
|
35 SetVF1
|
|
36 rts
|
|
37
|
|
38 VEFshowpic:
|
|
39 clra
|
|
40 VEFshow1
|
|
41 bsr showvef
|
|
42 inca
|
|
43 cmpa numpics
|
|
44 bne VEFshow1
|
|
45
|
|
46 * Now, were we displaying multiple pix??
|
|
47 lda numpics
|
|
48 cmpa #1
|
|
49 beq onepic
|
|
50 lda <cyclestart Disable cycling
|
|
51 sta <cycleend
|
|
52 lda #$ff
|
|
53 sta <flipping Enable flipping.
|
|
54 ldd #2
|
|
55 std <fliprate
|
|
56 onepic
|
|
57 rts
|
|
58
|
|
59 showvef
|
|
60 pshs a,b,x,y,u
|
|
61 bsr header Get header info
|
|
62 lbsr setscreen Set up screen
|
|
63 lbsr setpals Set up palettes
|
|
64
|
|
65 lbsr setbuffer Set up Get/Put Buffer
|
|
66 std linesize Store size of line in bytes.
|
|
67 lda VEFtype
|
|
68 cmpa #2
|
|
69 bne showvef00
|
|
70 ldd linesize Screen type 2 is simulated, so halve the linesize value
|
|
71 lsra
|
|
72 rorb
|
|
73 std linesize
|
|
74 showvef00
|
|
75
|
|
76 ldd <Skiplines Skip lines at top.
|
|
77 beq skip01
|
|
78 skip00
|
|
79 lbsr getline
|
|
80 subd #1
|
|
81 bne skip00
|
|
82 skip01
|
|
83
|
|
84 ldd #00 Now display 192 lines
|
|
85 showpicloop
|
|
86 lbsr getline
|
|
87 lbsr putline
|
|
88 addd #1
|
|
89 cmpd #192
|
|
90 bne showpicloop
|
|
91
|
|
92 showpicclear
|
|
93 lbsr getline Now read until end of picture (to prepare for next file).
|
|
94 tst endofpic
|
|
95 beq showpicclear
|
|
96
|
|
97 puls a,b,x,y,u,pc
|
|
98
|
|
99 *
|
|
100 * read header info from file, and set window type information
|
|
101 *
|
|
102 vsect dp
|
|
103 endoffile rmb 1
|
|
104 compression rmb 1 0= Normal, $80=Squashed
|
|
105 count rmb 1 Counts number packets to decode
|
|
106 linesleft rmb 1 Counts down lines in picture.
|
|
107 endsect
|
|
108
|
|
109 header
|
|
110 pshs a,b,x,y,u
|
|
111 clr endofpic
|
|
112 ldb #200
|
|
113 stb linesleft
|
|
114 leax altbuff,y read in type and palettes into altbuff
|
|
115 pshs y
|
|
116 ldy #18
|
|
117 lbsr I_Read
|
|
118 lbcs _error
|
|
119 puls y
|
|
120 leax altbuff,y
|
|
121 lda ,x+ This byte is the compression type: 0=none, $80=squashed.
|
|
122 beq header10
|
|
123 cmpa #$80 Squashed format
|
|
124 lbne E$Format
|
|
125 header10
|
|
126 sta compression
|
|
127 lda ,x+
|
|
128 cmpa #4
|
|
129 lbhi E$Format
|
|
130 sta VEFtype
|
|
131 tst <type
|
|
132 bne headtype
|
|
133 leau headtable,pcr
|
|
134 lda a,u
|
|
135 sta <type
|
|
136 headtype
|
|
137 leau palette,y
|
|
138 ldb #16
|
|
139 headloop
|
|
140 lda ,x+
|
|
141 sta ,u+
|
|
142 decb
|
|
143 bne headloop
|
|
144 bra headmisc
|
|
145 headtable fcb 8,7,8,6,5
|
|
146 headmisc
|
|
147 * Set some miscellaneous variables
|
|
148 lda #8 Set first, last palette for animation
|
|
149 sta <cyclestart
|
|
150 lda #15
|
|
151 sta <cycleend
|
|
152 ldd #5 Default animation delay
|
|
153 std <cyclerate
|
|
154 lda #0 No color rotation
|
|
155 sta <extranum
|
|
156 ldd <Skiplines
|
|
157 cmpd #$ffff Is Skiplines still default?
|
|
158 bne headskip No, don't change it.
|
|
159 ldd #8
|
|
160 std <Skiplines Set it to 8.
|
|
161 headskip
|
|
162 puls a,b,x,y,u,pc
|
|
163
|
|
164 *
|
|
165 * Getline
|
|
166 *
|
|
167 getline
|
|
168 pshs a,b,x,y,u
|
|
169 * First, fill buffers with all zeros
|
|
170 leau linebuff,y
|
|
171 ldb #160
|
|
172 getline3
|
|
173 clr ,u+
|
|
174 decb
|
|
175 bne getline3
|
|
176 * If at end of file, leave it that way
|
|
177 tst endoffile
|
|
178 bne getline1
|
|
179 * If at end of picture, leave it that way
|
|
180 tst endofpic
|
|
181 bne getline1
|
|
182 * Decrement lines left in pic, set endofpic if appropriate
|
|
183 dec linesleft
|
|
184 bne morelines
|
|
185 com endofpic
|
|
186 morelines
|
|
187 * Test compression method
|
|
188 tst compression
|
|
189 bmi squash
|
|
190 * Get an unsquashed line
|
|
191 pshs y
|
|
192 leax linebuff,y read in one line of screen
|
|
193 ldy linesize
|
|
194 lbsr I_Read
|
|
195 puls y
|
|
196 lbcs getline2 Error through EOF check.
|
|
197 bra getline0 Now exit.
|
|
198 * Get a squashed line
|
|
199 squash
|
|
200 leau linebuff,y
|
|
201 ldb #2
|
|
202 stb count
|
|
203 squash1
|
|
204 lbsr I_GetByte
|
|
205 bcs getline2
|
|
206 tfr a,b
|
|
207 clra
|
|
208 leax altbuff,y Use AltBuff to store data to unsquash
|
|
209 pshs y
|
|
210 tfr d,y
|
|
211 lbsr I_Read
|
|
212 puls y
|
|
213 lbcs getline2
|
|
214 ldd linesize
|
|
215 lsra
|
|
216 rorb Always decode half a line at a time.
|
|
217 bsr unsquash
|
|
218 dec count
|
|
219 bne squash1
|
|
220 bra getline0
|
|
221 * Handle read error
|
|
222 getline2
|
|
223 cmpb #E$EOF
|
|
224 bne getline4
|
|
225 com endoffile
|
|
226 bra getline1
|
|
227 * Finished reading line
|
|
228 getline0
|
|
229 lda VEFtype
|
|
230 cmpa #2
|
|
231 bne getline1
|
|
232 bsr expand
|
|
233 bra getline1
|
|
234 * Handle bad errors
|
|
235 getline4
|
|
236 lbra _error If not EOF, just exit with error.
|
|
237 * Exit getline
|
|
238 getline1
|
|
239 puls a,b,x,y,u,pc
|
|
240
|
|
241 *
|
|
242 * Expand a 160 pixel 16-color line to a 320 pixel 16-color line
|
|
243 *
|
|
244 expand
|
|
245 pshs a,b,x,y,u
|
|
246 leax linebuff,y
|
|
247 leay exptable,pcr
|
|
248 ldd linesize (Actually fits in just B)
|
|
249 leax d,x X points to end of 160 pixel line
|
|
250 leau d,x U points to end of 320 pixel line
|
|
251 exploop
|
|
252 lda ,-x
|
|
253 anda #$0f
|
|
254 lda a,y
|
|
255 sta ,-u
|
|
256 lda ,x
|
|
257 lsra
|
|
258 lsra
|
|
259 lsra
|
|
260 lsra
|
|
261 lda a,y
|
|
262 sta ,-u
|
|
263 decb
|
|
264 bne exploop
|
|
265 puls a,b,x,y,u,pc
|
|
266
|
|
267 exptable fcb $00,$11,$22,$33,$44,$55,$66,$77,$88,$99,$AA,$BB,$CC,$DD,$EE,$FF
|
|
268
|
|
269 *
|
|
270 * X points to data to unsquash, U points to destination buffer
|
|
271 * unsquashed result will be exactly B bytes.
|
|
272 * Exit: U points to end of unsquashed, all else unchanged.
|
|
273 *
|
|
274 vsect dp
|
|
275 unsq_count rmb 1
|
|
276 endsect
|
|
277
|
|
278 unsquash
|
|
279 pshs a,b,x
|
|
280 stb unsq_count
|
|
281 unsq_loop
|
|
282 ldb ,x+
|
|
283 beq unsq_end
|
|
284 bpl gl_straight
|
|
285 lda ,x+
|
|
286 * Deal with repeated byte
|
|
287 gl_comp
|
|
288 andb #$7f Strip off high bit
|
|
289 gl_comp2
|
|
290 sta ,u+ Store a copy of this byte
|
|
291 dec unsq_count
|
|
292 beq unsq_end
|
|
293 decb decrement repeat count
|
|
294 bne gl_comp2 Not done, loop
|
|
295 bra unsq_loop Done, get another control value from file.
|
|
296 * Deal with straight section
|
|
297 gl_straight
|
|
298 lda ,x+
|
|
299 sta ,u+ store it
|
|
300 dec unsq_count
|
|
301 beq unsq_end
|
|
302 decb count down bytes left
|
|
303 bne gl_straight
|
|
304 bra unsq_loop If done, get next section
|
|
305 unsq_end
|
|
306 puls a,b,x,pc
|
|
307
|
|
308 endsect
|