1706
|
1 *****************************************************************************
|
|
2 * *
|
|
3 * SUBS for RLE picture format *
|
|
4 * *
|
|
5 * RLEshowpic -- 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
|
|
17 use /dd/defs/os9defs.a
|
|
18 endc
|
|
19
|
|
20 psect view_rle_a,0,0,0,0,0
|
|
21
|
|
22 vsect dp
|
|
23 double rmb 1 Yes, double each line, and double each pixel count.
|
|
24 endsect
|
|
25
|
|
26 RLEshowpic:
|
|
27 bsr header Read header info, set palettes, etc.
|
|
28
|
|
29 lbsr setscreen
|
|
30 lbsr setpals
|
|
31 lbsr setbuffer
|
|
32
|
|
33 ldd #0
|
|
34 showpicloop
|
|
35 lbsr getline
|
|
36 lbsr putline
|
|
37 tst double
|
|
38 beq nodoub
|
|
39 lbsr putline
|
|
40 nodoub
|
|
41 addd #1
|
|
42 cmpd #192
|
|
43 bne showpicloop
|
|
44 rts
|
|
45
|
|
46 *
|
|
47 * read header info from file, and set window type information
|
|
48 *
|
|
49 vsect dp
|
|
50 endoffile rmb 1
|
|
51 endsect
|
|
52
|
|
53
|
|
54 header
|
|
55 pshs a,b,x,y,u
|
|
56 ldd #$003f Set palettes to white on black
|
|
57 std palette,y
|
|
58 lda #6
|
|
59 sta <type
|
|
60
|
|
61 head0
|
|
62 lbsr I_GetByte The start of an RLE picture is an ESC G sequence.
|
|
63 lbcs _error
|
|
64 cmpa #27
|
|
65 bne head0
|
|
66 head1
|
|
67 lbsr I_GetByte
|
|
68 lbcs _error
|
|
69 cmpa #27
|
|
70 beq head1
|
|
71 cmpa #'G
|
|
72 bne head0
|
|
73
|
|
74 lbsr I_GetByte
|
|
75 lbcs _error
|
|
76 cmpa #'H
|
|
77 beq headmisc
|
|
78 cmpa #'M
|
|
79 lbne E$Format Illegal format!
|
|
80 com double Turn on double flag.
|
|
81
|
|
82 headmisc
|
|
83 * Set some miscellaneous variables
|
|
84 clr <cyclestart
|
|
85 lda #1
|
|
86 sta <cycleend So we can toggle black/white
|
|
87 ldd #120
|
|
88 std <cyclerate
|
|
89
|
|
90 clr <cycle Turn off cycling
|
|
91 clr <extranum No color rotation
|
|
92 ldd <Skiplines
|
|
93 cmpd #$ffff Is Skiplines still default?
|
|
94 bne headskip No, don't change it.
|
|
95 ldd #0
|
|
96 std <Skiplines Set it to 0
|
|
97 headskip
|
|
98 puls a,b,x,y,u,pc
|
|
99
|
|
100 vsect dp
|
|
101 mask fcb $40 Mask to set a pixel
|
|
102 foreground rmb 1 In foreground or background? default=0.
|
|
103 count rmb 1
|
|
104 endsect
|
|
105
|
|
106 *
|
|
107 * Getline
|
|
108 *
|
|
109 getline
|
|
110 pshs a,b,x,y,u
|
|
111 * Clear out linebuff
|
|
112 leau linebuff,y
|
|
113 ldb #160
|
|
114 getline3
|
|
115 clr ,u+
|
|
116 decb
|
|
117 bne getline3
|
|
118 * If at end of file, leave it that way
|
|
119 tst endoffile
|
|
120 lbne getline1
|
|
121 * Get a line from the file
|
|
122 leax linebuff+8,y
|
|
123 clrb
|
|
124 lda count
|
|
125 bne setdoit
|
|
126 getbyte
|
|
127 com foreground
|
|
128 lbsr I_GetByte
|
|
129 bcs geteof
|
|
130 suba #$20
|
|
131 blo getbyte
|
|
132 tst double
|
|
133 beq setdoit
|
|
134 lsla Double count.
|
|
135 setdoit
|
|
136 sta count
|
|
137 beq getbyte
|
|
138 setloop
|
|
139 bsr pixset Set/reset this pixel
|
|
140 dec count
|
|
141 decb Count down pixels on line
|
|
142 beq getline1
|
|
143 tst count
|
|
144 beq getbyte End of repeat, get another byte.
|
|
145 bra setloop End of line, save leftover and quit.
|
|
146 * Handle EOF situation, any I/O error should come here.
|
|
147 geteof
|
|
148 cmpb #E$EOF
|
|
149 bne getline4
|
|
150 com endoffile
|
|
151 bra getline1
|
|
152 getline4
|
|
153 lbra _error If not EOF, just exit with error.
|
|
154 getline1
|
|
155 puls a,b,x,y,u,pc
|
|
156
|
|
157 pixset
|
|
158 pshs a
|
|
159 tst foreground
|
|
160 bne pixreset If in background, don't set the pixel.
|
|
161 lda ,x
|
|
162 ora mask
|
|
163 sta ,x
|
|
164 andcc #^Carry clear the carry flag.
|
|
165 pixreset
|
|
166 ror mask
|
|
167 bcc pixend If we went past the end of the byte,
|
|
168 ror mask Get the two mask bits out of the carry
|
|
169 leax 1,x Bump X to next byte.
|
|
170 pixend
|
|
171 ror mask
|
|
172 puls a,pc
|
|
173
|
|
174 endsect
|