annotate 3rdparty/utils/view/view_cm3.a @ 2265:581d99904cc5

makefiles updated
author boisy
date Mon, 28 Dec 2009 01:29:05 +0000
parents 37fd74e6fad8
children
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 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
3 * SUBS for CM3 picture formats
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
4 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
5 * CM3showpic -- display picture, using putline routine
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
6 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
7 *******************************************************************************
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
9 ifp1
1912
37fd74e6fad8 Now assembles with rma, uses os9defs.d in c3
boisy
parents: 1777
diff changeset
10 use os9defs.d
1706
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
11 endc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
12
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
13 StdOut equ 1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
14 StdErr equ 2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
15
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
16 psect view_cm3_a,0,0,0,0,0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
17
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
18 vsect dp
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
19 endoffile rmb 1 T= EOF reached, so always return linebuff all 0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
20 patterns rmb 1 T= patterns must be skipped
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
21 totscreens fcb 1 Total number of screens in picture
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
22 numscreens fcb 1 Number of screens remaining in picture- for Getline sub.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
23 lines rmb 1 Number of lines remaining on this screen
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
24 lastbyte rmb 1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
25 endsect
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
26
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
27
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
28 vsect
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
29 image rmb 20
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
30 action rmb 25
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
31 endsect
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
32
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
33 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
34 * Main picture display function
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
35 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
36 CM3showpic:
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
37 bsr header
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
38
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
39 pshs d
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
40 ldd <Skiplines
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
41 beq skip01
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
42 skip00
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
43 lbsr getline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
44 subd #1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
45 bne skip00
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
46 skip01
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
47
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
48 lbsr setscreen
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
49 lbsr setpals
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
50 lbsr setbuffer
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
51 lbsr getline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
52
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
53 spscreens
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
54 ldd #0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
55 showpicloop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
56 lbsr putline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
57 lbsr getline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
58 tst <Size
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
59 bgt spnoskip Size >0, don't do skip.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
60 pshs a
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
61 lda <totscreens
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
62 cmpa #2 Two screens?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
63 puls a
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
64 blo spnoskip No, ignore this.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
65 spskip
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
66 lbsr getline Yes, get another line.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
67 spnoskip
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
68 addd #1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
69 cmpd #192
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
70 bne showpicloop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
71 tst <Size
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
72 beq showpicend Only do another screen if not small size.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
73 lbsr getline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
74 tst <endoffile
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
75 bne showpicend
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
76 lbsr setscreen
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
77 lbsr setpals
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
78 bra spscreens
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
79 showpicend
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
80 puls d,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
81
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
82 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
83 * read header info from file, and set window type information
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
84 * Uses altbuff to store header as it's read from disk.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
85 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
86 header
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
87 pshs a,b,x,y,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
88 leax altbuff,y read in type and palettes
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
89 pshs y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
90 ldy #29
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
91 lbsr I_Read
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
92 puls y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
93 lbcs _error
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
94 leax altbuff,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
95 lda ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
96 cmpa #1 No patterns
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
97 beq head2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
98 cmpa #0 0 or $80 are types for screens with patterns
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
99 beq head0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
100 cmpa #$80
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
101 lbne E$Format
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
102 lda #2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
103 sta numscreens
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
104 sta totscreens
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
105 head0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
106 com patterns
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
107 head2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
108
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
109 leau palette,y Set palettes
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
110 ldb #16
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
111 headloop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
112 lda ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
113 sta ,u+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
114 decb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
115 bne headloop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
116
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
117 ldb ,x+ Store rate for palette rotation
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
118 clra
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
119 std <cyclerate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
120
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
121 ldd #$0b0e Palette cycling starts at palette 11, ends at 14
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
122 sta <cyclestart
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
123 stb <cycleend
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
124
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
125 ldb ,x+ Get rate for color cycling
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
126 clra
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
127 std <extrarate
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
128
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
129 ldb #8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
130 leau extrapals,y Set palette values for color cycling
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
131 head2loop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
132 lda ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
133 sta ,u+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
134 decb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
135 bne head2loop
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
136
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
137 lda #10
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
138 sta <extraslot
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
139
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
140 lda ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
141 bmi headanim If no animation, set cyclestart=cycleend
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
142 lda <cyclestart
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
143 sta <cycleend
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
144 headanim
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
145
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
146 ldb #8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
147 lda ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
148 bmi headrot Set number of values for color rotation.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
149 clrb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
150 headrot
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
151 stb <extranum
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
152
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
153 lda <type
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
154 bne headtype
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
155 lda #8 Set screen type to 8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
156 sta <type
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
157 headtype
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
158
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
159 lda #$ff
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
160 sta <cycle Turn cycling on.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
161
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
162 tst patterns Do we need to skip pattern info?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
163 beq head3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
164 leax linebuff,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
165 pshs y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
166 ldy #243 This many bytes of pattern info must be skipped.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
167 lbsr I_Read
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
168 puls y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
169 lbcs _error
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
170 head3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
171
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
172 ldd <Skiplines Set lines to skip if not already set.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
173 cmpd #$ffff
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
174 bne headskip
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
175 ldd #0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
176 std <Skiplines
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
177 headskip
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
178
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
179 lda <Size
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
180 bpl headsize
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
181 lda #1 Default size is BIG.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
182 sta <Size
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
183 headsize
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
184
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
185 ldd #120
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
186 std <fliprate Set to flip every 2 seconds.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
187
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
188 leax altbuff,y Clear out buffer with "last line" info.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
189 clrb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
190 headclear
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
191 clr ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
192 decb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
193 bne headclear
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
194
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
195 puls a,b,x,y,u,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
196
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
197
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
198 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
199 * Getline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
200 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
201 getline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
202 pshs a,b,x,y,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
203 * Clear line and check for end-of-file condition
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
204 leau linebuff,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
205 ldb #160
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
206 getl1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
207 clr ,u+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
208 decb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
209 bne getl1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
210 tst endoffile Are we at end-of-file?
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
211 lbne getline1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
212 * Check if we're at the beginning of a new screen.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
213 tst lines
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
214 bne getl2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
215 * If so, and numscreens=0, then end-of-file
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
216 dec numscreens
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
217 bpl getl3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
218 com endoffile
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
219 lbra getline1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
220 getl3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
221 lbsr I_GetByte
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
222 sta lines
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
223 getl2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
224 * get header byte
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
225 lbsr I_GetByte
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
226 * Test for compressed/uncompressed line.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
227 tsta
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
228 bpl getcomp
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
229 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
230 * Get uncompressed line.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
231 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
232 getnormal
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
233 leax linebuff,y read in one line of screen
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
234 pshs y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
235 ldy #160
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
236 lbsr I_Read
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
237 puls y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
238 lbcc getnor2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
239 geteof
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
240 cmpb #E$EOF watch for end-of-file
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
241 bne getnor1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
242 com endoffile Flag end-of-file condition
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
243 bra getnor2 Keep on going.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
244 getnor1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
245 lbra _error If not EOF, just exit with error.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
246 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
247 * Get compressed line.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
248 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
249 getcomp
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
250 leax image,y Initialize counters for image and action bits.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
251 stx <imptr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
252 leax action,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
253 stx <actptr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
254 ldb #8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
255 stb <imcnt
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
256 stb <actcnt
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
257
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
258 tfr a,b
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
259 clra
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
260 cmpd #21
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
261 lbhi E$Format if >21 action bytes, then error.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
262 addd #20 Get total number of bytes for image + action.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
263 tfr d,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
264 leax image,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
265 exg y,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
266 lbsr I_Read
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
267 exg y,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
268 lbcs geteof Test for end-of-file, etc.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
269
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
270 * decode a compressed packet
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
271 leax altbuff,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
272 leau linebuff,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
273 ldb #160
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
274 lda lastbyte A always holds the last byte on the line.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
275 getcomp0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
276 bsr tstimage
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
277 bcc getcomp9 image byte 0 -> repeat last byte
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
278 lda ,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
279 bsr tstaction 1 image & 0 action -> repeat from above
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
280 bcc getcomp9
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
281 lbsr I_GetByte 1 image & 1 action -> get new value
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
282 getcomp9
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
283 sta lastbyte
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
284 sta ,u+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
285 leax 1,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
286 decb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
287 bne getcomp0
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
288 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
289 * Now, put line where it belongs.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
290 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
291 getnor2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
292 leax linebuff,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
293 leau altbuff,y Copy linebuff to altbuff, to save last line
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
294 ldb #160
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
295 getnor3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
296 lda ,x+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
297 sta ,u+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
298 decb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
299 bne getnor3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
300 sta lastbyte
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
301 * If small and double-screen, then do horizontal compression.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
302 tst <Size
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
303 bne getline1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
304 lda <totscreens
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
305 cmpa #2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
306 bne getline1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
307 bsr squishline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
308 * Exit getline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
309 getline1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
310 dec lines
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
311 puls a,b,x,y,u,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
312
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
313 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
314 * These subs return consecutive bits from the appropriate bit arrays
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
315 *
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
316 vsect dp
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
317 actptr rmb 2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
318 actcnt rmb 1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
319 imptr rmb 2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
320 imcnt rmb 1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
321 endsect
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
322
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
323 tstaction
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
324 rol [actptr]
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
325 dec actcnt
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
326 bne tstact1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
327 pshs a,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
328 ldx actptr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
329 leax 1,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
330 stx actptr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
331 lda #8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
332 sta actcnt
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
333 puls a,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
334 tstact1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
335 rts
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
336
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
337 tstimage
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
338 rol [imptr]
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
339 dec imcnt
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
340 bne tstim1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
341 pshs a,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
342 ldx imptr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
343 leax 1,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
344 stx imptr
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
345 lda #8
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
346 sta imcnt
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
347 puls a,x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
348 tstim1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
349 rts
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
350
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
351 squishline
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
352 pshs a,b,x,y,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
353 leax linebuff,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
354 tfr x,u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
355 ldy #80 Total # of pairs of bytes.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
356 squish1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
357 ldd ,x++
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
358 lsrb Top nybble of B to bottom.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
359 lsrb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
360 lsrb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
361 lsrb
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
362 andb #$0f Mask off bottom nybble of B.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
363 anda #$f0 .. and top of A.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
364 pshs b Or them together.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
365 ora ,s+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
366 sta ,u+
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
367 leay -1,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
368 bne squish1
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
369
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
370 ldy #40 Clear out 40 bytes on right side.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
371 squish2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
372 clr ,-x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
373 leay -1,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
374 bne squish2
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
375
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
376 ldy #80 Move 80 bytes to center of screen.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
377 squish3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
378 lda ,-u
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
379 sta ,-x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
380 leay -1,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
381 bne squish3
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
382
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
383 ldy #40 Clear out 40 bytes on left side.
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
384 squish4
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
385 clr ,-x
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
386 leay -1,y
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
387 bne squish4
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
388 puls a,b,x,y,u,pc
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
389
6b23465701c0 Tim Kientzle's VIEW
boisy
parents:
diff changeset
390 endsect