LOSHOW.S (4471B)
1 lst off 2 3 org $c00 4 5 *------------------------------------------------- 6 7 dum 0 8 curpage ds 1 9 xsave ds 1 10 ysave ds 1 11 asave ds 1 12 temp ds 1 13 tmplo ds 1 14 tmphi ds 1 15 level ds 1 16 isGS? ds 1 17 dend 18 19 framebase = $1000 20 21 *------------------------------------------------- show 22 * 23 * put on the show! 24 * 25 26 show bit $C010 27 28 lda #0 29 sta isGS? 30 31 bit $C081 32 sec 33 jsr $fe1f ;GS? 34 bcs :notGS 35 36 inc isGS? 37 38 * Use special show frame routine for //GS that 39 * writes directly to bank $E0, since page two 40 * text is not properly shadowed to that bank. 41 42 ldx #$4C ;jmp 43 ldy #GSshowframe 44 lda #>GSshowframe 45 stx showframe 46 sty showframe+1 47 sta showframe+2 48 49 * Make our lookup tables up in ramcard area 50 51 :notGS bit $C083 52 bit $C083 53 54 jsr MAKEfade_tbls 55 56 jsr lgr 57 58 :again 59 60 ldx #0 61 :fadein stx level 62 lda #0 63 jsr showframe 64 ldx level 65 inx 66 cpx #15 67 bcc :fadein 68 69 * Here we go... 70 71 lda #0 72 :floop pha 73 ldx #15 74 jsr showframe 75 pla 76 clc 77 adc #1 78 cmp #23 79 bcc :floop 80 81 ldx #15 82 :fadeout stx level 83 lda #22 84 jsr showframe 85 ldx level 86 dex 87 bpl :fadeout 88 89 bit $C000 90 bpl *-3 91 bit $C010 92 93 jmp :again 94 95 *------------------------------------------------- lgr 96 * 97 * Clear and display lo-resolution screen 98 * 99 100 lgr sta $C000 ;turn off 55.54 select 101 sta $C00C ;40 columns 102 bit $C052 ;full screen 103 bit $C055 ;show page two 104 bit $C056 ;lores 105 bit $C050 ;graphics on 106 107 lda #4 ;use page one next 108 sta curpage 109 110 ldy #0 111 sty tmplo 112 sta tmphi 113 114 tya 115 ldx #8 116 117 :0 sta (tmplo),y 118 iny 119 bne :0 120 121 inc tmphi 122 dex 123 bne :0 124 125 rts 126 127 *------------------------------------------------- loget 128 * 129 * Enter with a:frame number 130 * x:fade level 131 * 132 133 showframe asl 134 asl 135 adc #>framebase 136 sta :src+2 ;hi byte 137 138 txa 139 ora #>fade_table 140 sta :fademod+2 141 142 lda curpage 143 sta :dst+2 144 eor #4!8 145 sta curpage 146 147 lda #4 148 sta temp 149 150 ldx #0 151 :loop 152 :src ldy $1100,x 153 :fademod lda fade_table+$F00,y 154 :dst sta $0400,x 155 inx 156 bne :loop 157 158 inc :src+2 ;hibyte 159 inc :dst+2 ; " " 160 161 dec temp 162 bne :loop 163 164 ]waitvbl jsr waitvbl 165 166 bit $C055 167 lda curpage 168 cmp #4 169 beq *+5 170 bit $C054 171 172 rts 173 174 GSshowframe asl 175 asl 176 adc #>framebase 177 sta :src+2 ;hi byte 178 179 txa 180 ora #>fade_table 181 sta :fademod+2 182 183 lda curpage 184 sta :dst+2 185 eor #4!8 186 sta curpage 187 188 lda #4 189 sta temp 190 191 ldx #0 192 :loop 193 :src ldy $1100,x 194 :fademod lda fade_table+$F00,y 195 :dst stal $E00400,x 196 inx 197 bne :loop 198 199 inc :src+2 ;hibyte 200 inc :dst+2 ; " " 201 202 dec temp 203 bne :loop 204 beq ]waitvbl 205 206 *------------------------------------------------- waitvbl 207 * 208 * Wait for a few vbl's to go by! 209 * 210 211 waitvbl ldx #6 212 :0 bit $C019 213 bpl :0 214 :1 bit $C019 215 bmi :1 216 dex 217 bne :0 218 rts 219 220 *------------------------------------------------- MAKEfade_tbls 221 * 222 * Make 16 lookup tables each containing 256 bytes 223 * for the 16 levels of fade-in. 224 * 225 226 MAKEfade_tbls dum 0 227 :curtmp ds 2 ;ptr into current tmp_scale table 228 :curfade ds 2 ;ptr into current page of fade table 229 :temp ds 1 230 :ysave ds 1 231 dend 232 233 jsr MAKEtmp_scale 234 235 ldy #tmp_scale 236 lda #>tmp_scale 237 sty :curtmp 238 sta :curtmp+1 239 240 ldy #fade_table 241 lda #>fade_table 242 sty :curfade 243 sta :curfade+1 244 245 * byte loop 246 247 ldy #0 248 249 :bloop tya 250 and #$0F 251 jsr :convert 252 sta :temp 253 254 tya 255 lsr 256 lsr 257 lsr 258 lsr 259 jsr :convert 260 asl 261 asl 262 asl 263 asl 264 ora :temp 265 266 sta (:curfade),y 267 268 iny 269 bne :bloop 270 271 * next fade table 272 273 inc :curfade+1 274 275 * next tmp table 276 277 clc 278 lda :curtmp 279 adc #16 280 sta :curtmp 281 bcc :bloop 282 283 rts 284 285 * given a=0-15, in lores unsequential grey scale, 286 * convert it back to sequential, lookup new value 287 * in tmp_scale table and then convert back to 288 * lores unsequential. 289 290 :convert sty :ysave 291 292 * Convert lores color back to sequential 00-0F 293 294 tax 295 lda :unlores,x 296 297 * Scale it 298 299 tay 300 lda (:curtmp),y 301 302 * Convert back to unsequential lores color 303 304 tax 305 lda isGS? 306 beq :notGS 307 lda :loresGS,x 308 bra :isGS 309 310 :notGS lda :lores2e,x 311 312 :isGS ldy :ysave 313 rts 314 315 :unlores hex 000301070405020a 316 hex 06080b0c090e0d0f 317 318 :loresGS hex 0002060104050803 319 hex 090c070a0b0e0d0f 320 321 :lores2e hex 00000000 322 hex 02020202 323 hex 06060606 324 hex 07070707 325 326 *------------------------------------------------- MAKEtmp_scale 327 * 328 * Make lookup table that contains values 329 * for 0-15 multiplied by 1/16... 16/16. 330 * 331 332 MAKEtmp_scale dum 0 333 :color ds 1 334 :scale ds 1 335 dend 336 337 lda #1 ;start with 1/16th 338 sta :scale 339 340 :sloop ldy #0 341 :cloop sty :color 342 lda #0 343 ldx :scale 344 :mloop clc 345 adc :color 346 dex 347 bne :mloop 348 lsr 349 lsr 350 lsr 351 lsr 352 :smc sta tmp_scale,y 353 iny 354 cpy #16 355 bne :cloop 356 inc :scale 357 lda :smc+1 358 clc 359 adc #16 360 sta :smc+1 361 bcc :sloop 362 rts 363 364 *------------------------------------------------- 365 366 dum $D000 367 fade_table ds $1000 368 tmp_scale ds $100 369 dend 370 371 *------------------------------------------------- EOF