FLD - Scrolling the screen by Marek Klampar (klampar@elf.stuba.sk) Scrolling the screen -------------------- _Scrolling the screen_ VIC begins to draw the screen from the first bad line. VIC will know what line is a bad line by comparing its scan line counter to the vertical scroll register : when they match, the next line is a bad line. If we change the vertical scroll register ($d011), the first bad line will move also. If we do this on every line, the line counter in VIC will never match with it and the drawing never starts (until it is allowed to do so). When we don't have to worry about bad lines, we have enough time to open the borders and do some other effects too. It is not necassary to change the vertical scroll on every line to get rid of the bad lines, just make sure that it never matches the line counter (or actually the least significant 3 bits). You can even scroll the bad lines independently and you have FLD - Flexible Line Distance. You just allow a bad line when it is time to display the next character row. With this you can bounce the lines or scroll a hires picture very fast down the screen. (*** end of Albert's paragraph ***) Well, everything important was written. I'm just adding this: For moving hires picture replace ORA #$10 by ORA #$30. For another FX try to replace part of irq routine begining with ORA #$10 by: ORA #$C0 STA $D016, remove JSR CHOFS, replace LDX OFSET by LDX #$ff and enjoy =) The demonstartion program for FLD application ;--------------------------------------- ; Commodore Cracker 1993 ;--------------------------------------- FROM = $32 TO = $FA ;--------------------------------------- *= $C000 ;--------------------------------------- INIT LDA #0 STA DIR ; Direction LDA #$FF ; Set garbage STA $3FFF LDA #FROM STA OFSET ; Set ofset SEI ; Disable interrupt LDA #$7F ; Disable timer interrupt STA $DC0D LDA #1 ; Enable raster interrupt STA $D01A LDA #IRQ STA $0315 LDA #0 ; To evoke our irq routine on 0th line STA $D012 CLI ; Enable interrupt RTS ;--------------------------------------- IRQ LDX OFSET L2 LDY $D012 ; Moving 1st bad line L1 CPY $D012 BEQ L1 ; Wait for begin of next line DEY ; IY - bad line TYA AND #$07 ; Clear higher 5 bits ORA #$10 ; Set text mode STA $D011 DEX BNE L2 INC $D019 ; Acknowledge the raster interrupt JSR CHOFS JMP $EA31 ; Do standard irq routine ;--------------------------------------- OFSET .BYTE FROM DIR .BYTE 0 ;--------------------------------------- CHOFS LDA DIR ; Change OFSET of screen BNE UP INC OFSET ; Down LDA OFSET CMP #TO BNE SKIP STA DIR SKIP RTS ;--------------------------------------- UP DEC OFSET ; Up LDA OFSET CMP #FROM BNE SKIP LDA #0 STA DIR RTS