;View FLI pic ;All source by Fungus in '96 ;With a little help from his friends ;FLI pic loads from $3b00-$8000 *= $0900 ;Set Origin line = $2e ;IRQ line pointer cld ;Clear Decimal Mode sei ;Disable IRQ's lda #$00 ;Wait till raster line is in the bottom border cmp $d012 bne *-3 sta $d000 ;Init Vic II sta $d001 sta $d002 sta $d003 sta $d004 sta $d005 sta $d006 sta $d007 sta $d008 sta $d009 sta $d00a sta $d00b sta $d00c sta $d00d sta $d00e sta $d00f sta $d010 sta $d011 sta $d015 sta $d017 sta $d01b sta $d01c sta $d01d sta $d020 sta $d021 sta $d022 sta $d023 sta $d024 sta $d025 sta $d026 sta $d027 sta $d028 sta $d029 sta $d02a sta $d02b sta $d02c sta $d02d sta $d02e sta $d02f sta $d030 lda #irq1 ldy #$1f sta $fffe stx $ffff sty $dc0d ;Disable CIA IRQ's and NMI's sty $dd0d lda #nmi ;routine (for Turbo Assembler) ldy #$05 sta $fffa sta $fffc stx $fffb stx $fffd sty $01 ;Bank out Basic and Kernal ROM's lda #$01 ;Enable Raster IRQ ldx #$38 ;Set screen to start at line $30 , set high bit of ;$d012, and Enable BITMAP mode ldy #line ;Set Raster IRQ to occur on line $2e sta $d01a stx $d011 sty $d012 lda #$d8 ;Turn on Multi Color Mode ldx #$18 ;Set Screen to BITMAP 1 ldy #$02 ;Set Video Memory to Bank 1 sta $d016 sta $d018 sty $dd00 ldx #$ff ;Clear the Stack txs jsr clrscrn jsr clrcolor jsr fliinit asl $d019 ;Ack any Previous Raster IRQ (clear IRQ flags) lda $dc0d ;Ack any Previous CIA 1 IRQ (clear IRQ flags) lda $dd0d ;Ack any Previous CIA 2 NMI (clear NMI flags) cli ;Renable IRQ's jmp * ;Endless loop irq1 ;Double IRQ part 1 for stable raster sta reseta1 ;Save A register (self modifying for speed) stx resetx1 ;Save X register (self modifying for speed) sty resety1 ;Save Y register (self modifying for speed) lda #irq2 ldy #line+1 ;Set Raster IRQ to occur on next line sta $fffe stx $ffff sty $d012 asl $d019 ;Ack Raster IRQ (clear irq flags) tsx ;Save Stack pointer temporarily since we want to ;return to our endless loop and not the end of this ;IRQ cli ;Renable Raster IRQ nop ;Execute 2 cycle instructions so next IRQ is within nop ;1 cycle of Raster Register change ($d012) nop nop nop nop nop nop nop nop nop nop nop nop irq2 ;Double IRQ part 2 txs ;Return stack pointer ldx #$08 ;Wait exactly 1 line before compare dex bne *-1 bit $ea nop nop lda #line+1 cmp $d012 ;Did the line change yet? If not, waste 1 more cycle beq wait wait ldy #$18 ;Number of rows counter ldx #$03 ;Wait till next line dex bne *-1 beq enter viewfli ;FLI routine is here bit $ea ;Timing nop lda #$08 ;Set screen to BITMAP 0 sta $d018 lda #$38 ;Force bad line (to fetch new colors) sta $d011 inc delay ;Wait for next line dec delay,x enter lda #$18 ;The first time we enter here because bad line ;already occured sta $d018 ;Set screen to BITMAP 1 lda #$39 ;Force bad line sta $d011 inc delay ;Wait for next line dec delay,x lda #$28 ;Set screen to BITMAP 2 sta $d018 lda #$3a ;Force bad line sta $d011 inc delay ;Wait for next line dec delay,x lda #$38 ;Set screen to BITMAP 3 sta $d018 lda #$3b ;Force bad line sta $d011 inc delay ;Wait for next line dec delay,x lda #$48 ;Set screen to BITMAP 4 sta $d018 lda #$3c ;Force bad line sta $d011 inc delay ;Wait for next line dec delay,x lda #$58 ;Set screen to BITMAP 5 sta $d018 lda #$3d ;Force bad line sta $d011 inc delay ;Wait for next line dec delay,x lda #$68 ;Set screen to BITMAP 6 sta $d018 lda #$3e ;Force bad line sta $d011 inc delay ;Wait for next line dec delay,x lda #$78 ;Set screen to BITMAP 7 sta $d018 lda #$3f ;Force bad line sta $d011 dey ;Are we done yet? bmi exit1 ;If we are then exit loop jmp viewfli ;No we are not, so loop again exit1 lda #$70 ;Turn on Extended Color Mode to blank bottom of ;screen and remove the top and bottom borders sta $d011 lda #irq3 ldy #$fb ;Set next Raster IRQ to occur on line $fa sta $fffe stx $ffff sty $d012 asl $d019 ;Ack Raster IRQ (clear IRQ flags) lda #$00 ;Restore A register reseta1 = *-1 ldx #$00 ;Restore X register resetx1 = *-1 ldy #$00 ;Restore Y register resety1 = *-1 rti ;Return from IRQ irq3 sta reseta2 ;Save A register stx resetx2 ;Save X register sty resety2 ;Save Y register lda #$08 ;Set screen to BITMAP 0 ldx #$38 ldy #$48 ;Wait Timer sta $d018 dey bne *-1 stx $d011 ;Turn Extended Color Mode off so screen is visible lda #irq1 ldy #line ;Set next Raster IRQ to occur on line $2e sta $fffe stx $ffff sty $d012 asl $d019 ;Ack Raster IRQ (clear IRQ flags) lda #$00 ;Restore A register reseta2 = *-1 ldx #$00 ;Restore X register resetx2 = *-1 ldy #$00 ;Restore Y register resety2 = *-1 rti ;Return from IRQ nmi lda #$81 ;Turn on CIA 1 IRQ's ldx #$00 ;Turn off Raster IRQ's ldy #$07 ;Bank Basic and Kernal ROM's in sta $dc0d stx $d01a sty $01 lda #$1b ;Turn off BITMAP Mode and return screen origin ;to line $32 ldx #$17 ;Lower Case Character Set ldy #$c8 ;Turn off Multi Color Mode sta $d011 stx $d018 sty $d016 ldx #$ff ;Clear the Stack txs asl $d019 ;Ack any Raster IRQ's pending lda $dc0d ;Ack any CIA 1 IRQ's pending lda $dd0d ;Ack and CIA 2 NMI's pending cli ;Renable IRQ's jmp $9000 ;Back to Turbo Assembler fliinit ldx #$00 there1 lda $3c00,x sta $d800,x lda $3d00,x sta $d900,x lda $3e00,x sta $da00,x lda $3f00,x sta $db00,x dex bne there1 rts clrscrn ldx #$00 lda #$20 scrnclr sta $0400,x sta $0500,x sta $0600,x sta $0700,x dex bne scrnclr rts clrcolor lda #$00 tax colorclr sta $d800,x sta $d900,x sta $da00,x sta $db00,x dex bne colorclr rts delay .byte $00 ;Byte for timing routines