Classic Computer Magazine Archive PROGRAM LISTING: 85-05/FADERII.M65


0100 ;FADERII.M65
0101 ;BY PATRICK DELL'ERA
0102 ;ANTIC MAGAZINE
0104 ;
0105 PROGRAM = $3E00
0106 BUFFER = $2007
0107 ;External reference equates
0108 LBL:105 = BUFFER+2
0109 LBL:106 = BUFFER+3
0110 LBL:091 = BUFFER+4
0111 LBL:064 = BUFFER+$0B
0112 LBL:121 = BUFFER+$0D
0113 LBL:125 = BUFFER+$0E
0114 LBL:127 = BUFFER+$16
0115 LBL:080 = BUFFER+$21
0116 LBL:107 = BUFFER+$22
0117 LBL:083 = BUFFER+$23
0118 LBL:078 = BUFFER+$24
0119 ;End of external references
0120 ;
0121 ;System equates used
0122 BOOT =  $09
0123 DOSVEC = $0A
0124 RTCLOK = $12
0125 SOUNDR = $41
0126 ATRACT = $4D
0127 SAVMSC = $58
0128 SDLSTL = $0230
0129 SDLSTH = $0231
0130 COLDST = $0244
0131 RUNADR = $02E0
0132 COLOR0 = $02C4
0133 COLOR1 = $02C5
0134 COLOR2 = $02C6
0135 COLOR4 = $02C8
0136 ICCOM = $0342
0137 ICBAL = $0344
0138 ICBAH = $0345
0139 ICBLL = $0348
0140 ICBLH = $0349
0141 ICAX1 = $034A
0142 ICAX2 = $034B
0143 CONSOL = $D01F
0144 RANDOM = $D20A
0145 CIOV =  $E456
0146 EOL =   $9B
0147 ;End of system equates
0148 ;Zero-page equates
0149 PIC.CTR = $E0
0150 N09 =   $EA
0151 CTR1 =  $BA
0152 CTR2 =  $BB
0153 SVCOLR = $CC
0154 PICTYPE = $CB
0155 N16 =   $EC
0156 N17 =   $E6
0157 N18 =   $E4
0158 N19 =   $E1
0159 N22 =   $E3
0160 N23 =   $EB
0161 N24 =   $E2
0162 N27 =   $E9
0163 N41 =   $80
0164 N42 =   $81
0165 N54 =   $82
0166 N55 =   $83
0167 N59 =   $84
0168 N60 =   $85
0169 ;End of zero-page equates
0170     .PAGE "Main Program  11/10/84"
0171 ;
0172 ;Program Start
0173 ; First two bytes are variables
0174 ; indicating the Pause length
0175 ; and the Drive # pictures are
0176 ; read from.
0177 ;
0178     *=  PROGRAM
0179 WAIT
0180     .BYTE 2
0181 DRNUM
0182     .BYTE '1
0183 ;
0184 ;Routine to load compressed
0185 ; files.
0186 ;
0187 READ.HDR
0188     INC PIC.CTR
0189     JMP GET.BYTE
0190 PIC.LDR
0191     LDA #$FF
0192     STA PIC.CTR
0193 LBL:007
0194     JSR READ.HDR
0195     LDX PIC.CTR
0196     CPX #$1A
0197     BEQ LBL:006
0198     CPX #$0D
0199     BEQ SVCOLR.PIC
0200     CPX #7
0201     BNE LBL:007
0202     STA N09
0203     JMP LBL:007
0204 SVCOLR.PIC
0205     STA SVCOLR+1
0206     JSR READ.HDR
0207     STA SVCOLR+2
0208     JSR READ.HDR
0209     STA SVCOLR+3
0210     JSR READ.HDR
0211     STA SVCOLR+4
0212     JSR READ.HDR
0213     STA SVCOLR
0214     JMP LBL:007
0215 LBL:006 LDA #0
0216     STA N16
0217     STA N17
0218     LDA SAVMSC
0219     STA PIC.CTR
0220     STA N18
0221     LDA SAVMSC+1
0222     STA PIC.CTR+1
0223     STA N18+1
0224 LBL:030 JSR GET.BYTE
0225     PHA 
0226     LDX #0
0227     STX N22
0228     AND #$80
0229     STA N23
0230     PLA 
0231     AND #$7F
0232     STA N24
0233     BNE LBL:025
0234     JSR GET.BYTE
0235     STA N22
0236     JSR GET.BYTE
0237     STA N24
0238 LBL:025 DEC N24
0239     LDA N23
0240     BNE LBL:026
0241     JSR GET.BYTE
0242     STA N27
0243 LBL:029
0244     JMP LBL:028
0245 LBL:032 DEC N24
0246     LDA #$FF
0247     CMP N24
0248     BNE LBL:029
0249     DEC N22
0250     LDA #$FF
0251     CMP N22
0252     BNE LBL:029
0253     BEQ LBL:030
0254 LBL:036 DEC N24
0255     LDA #$FF
0256     CMP N24
0257     BNE LBL:026
0258     DEC N22
0259     LDA #$FF
0260     CMP N22
0261     BEQ LBL:030
0262 LBL:026 JSR GET.BYTE
0263     STA N27
0264 LBL:028 LDA #2
0265     CMP N09
0266     BEQ LBL:031
0267 LBL:035 BEQ LBL:032
0268     LDA N27
0269     LDY #0
0270     STA (PIC.CTR),Y
0271     CLC 
0272     LDA #$50
0273     ADC PIC.CTR
0274     STA PIC.CTR
0275     LDA #0
0276     ADC PIC.CTR+1
0277     STA PIC.CTR+1
0278     INC N17
0279     LDA #$60
0280     CMP N17
0281     BNE LBL:033
0282     LDA #1
0283     CMP N16
0284     BNE LBL:034
0285     CLC 
0286     LDA #1
0287     ADC N18
0288     STA N18
0289     STA PIC.CTR
0290     LDA #0
0291     STA N16
0292     STA N17
0293     ADC N18+1
0294     STA N18+1
0295     STA PIC.CTR+1
0296     JMP LBL:033
0297 LBL:034 INC N16
0298     CLC 
0299     LDA #$28
0300     ADC N18
0301     STA PIC.CTR
0302     LDA #0
0303     STA N17
0304     ADC N18+1
0305     STA PIC.CTR+1
0306 LBL:033 LDA N23
0307     BEQ LBL:035
0308 LBL:037 BNE LBL:036
0309 LBL:031 LDA N27
0310     LDY #0
0311     STA (PIC.CTR),Y
0312     INC PIC.CTR
0313     BNE LBL:031.1
0314     INC PIC.CTR+1
0315 LBL:031.1
0316     LDA N23
0317     BEQ LBL:035 ;Forced branch
0318     BNE LBL:037 ;
0319 ;
0320 ;CIO utilities
0321 ;
0322 GET.BYTE
0323     LDX #$10
0324     LDA #0
0325     STA ICBLL,X
0326     STA ICBLH,X
0327     JSR CIOV
0328     BMI LBL:038
0329     RTS 
0330 LBL:038 PLA 
0331     PLA 
0332     JMP MIC.1
0333 CLOSE.CH1
0334     LDX #$10
0335 CLOSE.CH6
0336     LDA #$0C
0337     STA ICCOM,X
0338     JMP CIOV
0339 OPEN.1
0340     STA ICBAH,X
0341     TYA 
0342     STA ICBAL,X
0343     LDA #3
0344     STA ICCOM,X
0345 LBL:040 JSR CIOV
0346     BMI EXIT
0347     RTS 
0348 EXIT JSR CLOSE.CH1
0349     JMP (DOSVEC)
0350 ;
0351 ;Picture fader routine
0352 ;
0353 MSKTBL
0354     .BYTE $01,$08,$40,$02
0355     .BYTE $10,$80,$04,$20
0356 FADEIN
0357     LDA SAVMSC
0358     STA N41
0359     STA N54
0360     LDA #0
0361     STA CTR2
0362 LBL:104 LDA #7
0363     CMP CTR2
0364     BCS LBL:087
0365     RTS 
0366 LBL:087 LDX CTR2
0367     LDA #0
0368     STA LBL:080
0369 LBL:090 LDA #$FE
0370     CMP LBL:080
0371     BCC LBL:088
0372     TXA 
0373     PHA 
0374     LDX LBL:080
0375     LDY LBL:078,X
0376     PLA 
0377     TAX 
0378     JSR LBL:089
0379     INC LBL:080
0380     JMP LBL:090
0381 LBL:088 TXA 
0382     PHA 
0383     LDX #$FF
0384     LDY LBL:078,X
0385     PLA 
0386     TAX 
0387     JSR LBL:089
0388     LDA LBL:091
0389     BMI LBL:092
0390     LDY CTR2
0391     CPY #2
0392     BNE LBL:093
0393     LDA SVCOLR-1,Y
0394     STA COLOR0
0395 LBL:093
0396     CPY #3
0397     BNE LBL:096
0398     LDA SVCOLR-1,Y
0399     STA COLOR1
0400 LBL:096
0401     CPY #4
0402     BNE LBL:099
0403     LDA SVCOLR-1,Y
0404     STA COLOR2
0405 LBL:099
0406     CPY #5
0407     BNE LBL:092
0408     LDA SVCOLR
0409     STA COLOR4
0410 LBL:092 INC CTR2
0411     JMP LBL:104
0412 LBL:089
0413     LDA LBL:105
0414     STA N42
0415     LDA LBL:106
0416     STA N55
0417     LDA #0
0418     STA LBL:107
0419 LBL:113 LDA #$1D
0420     CMP LBL:107
0421     BCS LBL:108
0422     RTS 
0423 LBL:108 LDA (N41),Y
0424     AND MSKTBL,X
0425     BNE LBL:111
0426     LDA MSKTBL,X
0427     EOR #$FF
0428     AND (N54),Y
0429     JMP LBL:112
0430 LBL:111 ORA (N54),Y
0431 LBL:112 STA (N54),Y
0432     INC N42
0433     INC N55
0434     INX 
0435     TXA 
0436     AND #7
0437     TAX 
0438     INC LBL:107
0439     JMP LBL:113
0440 ;
0441 ;Program Entry
0442 ;
0443 START
0444     LDA DRNUM   ;User alterable
0445     STA DDVC+1  ;drive #
0446     LDX #1      ;Tells system
0447     STX BOOT    ;no Coldstart
0448     STX PICTYPE ;and initializes
0449     DEX 
0450     STX COLDST
0451     STX SOUNDR  ;No disk sound
0452 ;
0453 ;Build random table for fading
0454 ;picture.
0455 ;
0456 LBL:079 TXA 
0457     STA LBL:078,X
0458     INX 
0459     BNE LBL:079
0460     STX LBL:080
0461 LBL:081
0462     LDA #$FF
0463     STA N60
0464     EOR LBL:080
0465     PHA 
0466     STA N59
0467 LBL:062 ASL A
0468     BCS LBL:061
0469     LSR N60
0470     JMP LBL:062
0471 LBL:061 LDA RANDOM
0472     AND N60
0473     CMP N59
0474     BEQ LBL:063
0475     BCS LBL:061
0476 LBL:063
0477     STA LBL:083
0478     TAX 
0479     LDA LBL:078,X
0480     TAY 
0481     PLA 
0482     PHA 
0483     TAX 
0484     LDA LBL:078,X
0485     LDX LBL:083
0486     STA LBL:078,X
0487     PLA 
0488     TAX 
0489     TYA 
0490     STA LBL:078,X
0491     INC LBL:080
0492     INC PICTYPE
0493     BNE LBL:081
0494 ;
0495 ;Build screen dislpay list by
0496 ;closing channel 6
0497 ;
0498     LDX #$60
0499     JSR CLOSE.CH6
0500 ;
0501 ;Then open GRAPHICS 8+16
0502 ;
0503     LDA #$0C
0504     STA ICAX1,X
0505     LDA #8
0506     STA ICAX2,X
0507     LDY # <SDVC
0508     LDA # >SDVC
0509     JSR OPEN.1
0510 ;
0511 ;Give screen some color and
0512 ;modify display list to
0513 ;ANTIC E (GRAPHICS 7+) display
0514 ;list
0515 ;
0516     LDA #$80
0517     STA COLOR4
0518     LDA SDLSTL
0519     STA N41
0520     LDA SDLSTH
0521     STA N42
0522     LDY #3
0523     LDA #$4E
0524     STA (N41),Y
0525     LDY #6
0526 LBL:071 LDA #$0E
0527     STA (N41),Y
0528     INY 
0529     CPY #$63
0530     BNE LBL:071
0531     LDA #$4E
0532     STA (N41),Y
0533     INY 
0534     INY 
0535     INY 
0536 LBL:073 LDA (N41),Y
0537     CMP #$0F
0538     BNE LBL:072.A
0539     LDA #$0E
0540     STA (N41),Y
0541     INY 
0542     BNE LBL:073
0543 ;
0544 ;Set pointers to a hidden
0545 ;screen used to fade new
0546 ;picture into old.
0547 ;
0548 LBL:072.A
0549     STA LBL:106
0550     LDA SAVMSC+1
0551     STA LBL:106
0552     LDA LBL:106
0553     SEC 
0554     SBC #$20
0555     STA LBL:105
0556     LDA LBL:105
0557     STA SAVMSC+1
0558 ;
0559 ;Set ctr to point to first
0560 ;picture.
0561 ;
0562 FIRST.PIC LDA #1
0563     STA CTR1
0564 ;
0565 ;Open the disk directory for
0566 ;reading.
0567 ;
0568 NXT.PIC
0569     JSR CLOSE.CH1
0570     LDA #6
0571     STA ICAX1,X
0572     LDA #0
0573     STA ICAX2,X
0574     LDY # <DDVC
0575     LDA # >DDVC
0576     JSR OPEN.1
0577     STY CTR2    ;Y=0 always...
0578 ;
0579 ;Read filenames 'til CTR2=CTR1.
0580 ;CTR1 is index to which
0581 ;picture was last shown.
0582 ;
0583 LBL:119 LDA CTR1
0584     CMP CTR2
0585     BCC LBL:118
0586     LDX #$10
0587     LDA # <LBL:064+1
0588     STA ICBAL,X
0589     LDA # >LBL:064+1
0590     STA ICBAH,X
0591     LDA #20
0592     STA ICBLL,X
0593     LDA #0
0594     STA ICBLH,X
0595     LDA #5
0596     STA ICCOM,X
0597     JSR CIOV
0598     BMI FIRST.PIC
0599     INC CTR2
0600     BNE LBL:119
0601 ;
0602 ;Have read the correct # of
0603 ;filenames.  Now check if
0604 ;this is a FREE SECTORS message.
0605 ;If yes, start from 1st picture.
0606 ;
0607 LBL:118
0608     JSR CLOSE.CH1
0609     LDA LBL:121
0610     CMP #$20
0611     BNE FIRST.PIC
0612 ;
0613 ;Stick "D1:" in front of
0614 ;filename.
0615 ;
0616     LDX #2
0617 NAME.LOOP LDA DDVC,X
0618     STA LBL:064,X
0619     DEX 
0620     BPL NAME.LOOP
0621 ;
0622 ;Then reform name with no
0623 ;spaces, a period, the extender,
0624 ;and an end-of-line.
0625 ;
0626 NAME.LOOP.1 INX 
0627     CPX #8
0628     BEQ NAME.LOOP.2
0629     LDA LBL:125,X
0630     CMP #$20
0631     BNE NAME.LOOP.1
0632 NAME.LOOP.2 LDY LBL:127
0633     LDA #'.
0634     STA LBL:125,X
0635     TYA 
0636     INX 
0637     STA LBL:125,X
0638     STA PICTYPE
0639     LDA #'I
0640     INX 
0641     STA LBL:125,X
0642     LDA #'C
0643     INX 
0644     STA LBL:125,X
0645     LDA #EOL
0646     INX 
0647     STA LBL:125,X
0648 ;
0649 ;Open the picture for reading.
0650 ;
0651     JSR CLOSE.CH1
0652     LDA #4
0653     STA ICAX1,X
0654     LDA #0
0655     STA ICAX2,X
0656     LDY # <LBL:064
0657     LDA # >LBL:064
0658     JSR OPEN.1
0659     LDA LBL:105
0660     STA SAVMSC+1
0661     LDA #7
0662     LDX #$10
0663     STA ICCOM,X
0664 ;
0665 ;If the extender is 'PIC' then
0666 ;go to compressed picture load
0667 ;routine.
0668 ;
0669     LDY PICTYPE
0670     CPY #'P
0671     BNE MIC
0672     JMP PIC.LDR
0673 ;
0674 ;Otherwise, do standard load.
0675 ;
0676 MIC
0677     LDA SAVMSC
0678     STA ICBAL,X
0679     LDA SAVMSC+1
0680     STA ICBAH,X
0681     LDA #0
0682     STA ICBLL,X
0683     LDA #$1E
0684     STA ICBLH,X
0685     JSR LBL:040
0686     JSR GET.BYTE
0687     STA SVCOLR
0688     JSR GET.BYTE
0689     STA SVCOLR+1
0690     JSR GET.BYTE
0691     STA SVCOLR+2
0692     JSR GET.BYTE
0693     STA SVCOLR+3
0694 ;
0695 ;Both load types continue here.
0696 ;Fade new picture in.  Pause
0697 ;and read console keys.
0698 ;
0699 MIC.1
0700     JSR FADEIN
0701     JSR CLOSE.CH1
0702     LDA #0
0703     STA ATRACT
0704     STA RTCLOK+1
0705 LBL:134 LDA RTCLOK+1
0706     CMP WAIT
0707     BCS LBL:130
0708 LBL:132 LDA CONSOL
0709     CMP #5
0710     BNE LBL:133
0711     JMP EXIT
0712 LBL:133 CMP #3
0713     BNE LBL:133.1
0714 LBL:133.2
0715     LDA #6
0716 LBL:133.3
0717     CMP CONSOL
0718     BNE LBL:133.3
0719 LBL:133.1
0720     CMP #6
0721     BNE LBL:134
0722 LBL:130 INC CTR1
0723     JMP NXT.PIC
0724 DDVC
0725     .BYTE "D1:*.?IC",EOL
0726 SDVC
0727     .BYTE "S:",EOL
0728     *=  RUNADR
0729     .WORD START
0730     .SET 1,0

Back to previous page