User Tools

Site Tools


base:techtech_fli

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
base:techtech_fli [2016-04-21 12:52] – Created this page compyxbase:techtech_fli [2016-04-22 12:41] (current) – added a screenshot compyx
Line 3: Line 3:
 ===== Introduction ===== ===== Introduction =====
  
-Below is an example of a tech-tech effect, achieved using a so-called FLI-routine. This is **not** a tech-tech with a FLI logo, its a simple character set based routine using FLI to allow videoram switching at every rasterline.+Below is an example of a tech-tech effect, achieved using a so-called FLI-routine. This is **not** a tech-tech with a FLI logo, its a simple FLI based routine to allow videoram switching at every rasterline. 
 + 
 +The routine differs from [[magazines:chacking7#tech-tech_-_more_resolution_to_vertical_shift]|this article]] in that it uses videoram banks to create the tech-tech, not character sets. One could combine these two techniques by cleverly interleaving character sets and videoram to allow for a wider sinus, perhaps even bank switching with $dd00 for even more movement. I'll leave that as an exercise for the reader ;) 
 + 
 +{{:base:tech-tech-fli.png?404|Screenshot of the tech-tech in action}}
  
 I wrote this code as part of an attempt to regain my old VIC-trickery skills, it's been about 25 years since I did a tech-tech. As such, the code may not be up to today's standards. I just published it here since there was no article on tech-tech's using $d011/FLI. I wrote this code as part of an attempt to regain my old VIC-trickery skills, it's been about 25 years since I did a tech-tech. As such, the code may not be up to today's standards. I just published it here since there was no article on tech-tech's using $d011/FLI.
 +
 +Note: I don't explain FLI in detail in this article, there are other articles here which explain FLI properly. 
  
 The code can be assembled by using [[https://sourceforge.net/projects/tass64/|64tass]]: The code can be assembled by using [[https://sourceforge.net/projects/tass64/|64tass]]:
Line 11: Line 17:
  
  
- +===== The Theory =====
-====== The Theory =====+
  
 //I'll use the word 'logo' here to simplify things a bit. My code doesn't actually include a logo, just some text //I'll use the word 'logo' here to simplify things a bit. My code doesn't actually include a logo, just some text
Line 46: Line 51:
 This code we need to do for each (raster)line of the logo. But we have a problem... This code we need to do for each (raster)line of the logo. But we have a problem...
  
-===== The problem =====+===== The Problem =====
  
 Manipulating $d016 on each raster line works fine, manipulating $d018 doesn't: the videoram pointer only gets updated on bad lines (every 8th raster line), so we need a way to update the videoram pointer on each raster line. That's were FLI comes in. Manipulating $d016 on each raster line works fine, manipulating $d018 doesn't: the videoram pointer only gets updated on bad lines (every 8th raster line), so we need a way to update the videoram pointer on each raster line. That's were FLI comes in.
  
-===== The solution =====+===== The Solution ===== 
 + 
 +Using the so-called FLI technique, we can trigger bad lines at every raster line, allowing us to manipulate the videoram pointer at every raster line. 
 + 
 +So our basic tech-tech display routine would look like this: (loop unrolled to keep the FLI bug at three characters while using a single sprite to cover the bug) 
 +<code 6502tasm> 
 +; sinus = 0 
 +lda #$1b 
 +sta $d011 
 +lda #$00    ; 0 & 7 == 0 
 +sta $d016 
 +lda #$20    ; column 0 
 +sta $d018 
 + 
 +; sinus = 3 
 +; next rasterline 
 +lda #$1c 
 +sta $d011 
 +lda #$03 
 +sta $d016 
 +lda #$20    ; still column 0 
 +sta $d018 
 + 
 +; sinus = 6 
 +lda #$1d 
 +sta $d011 
 +lda #$06 
 +sta $d016 
 +lda #$20 
 +sta $d018 
 + 
 +; sinus = 9 
 +lda #$1e 
 +sta $d011 
 +lda #$01    ; 9 & 7 == 1 
 +sta $d016 
 +lda #$30 
 +sta $d018   ; column 1: 9 pixels means we need to select 
 +            ; the second videoram bank to move the logo 
 +            ; one column to the right 
 + 
 +; and so on for each line of the logo, wrapping the $d011 
 +; value around from $1f to $18 
 +</code> 
 + 
 +Now we can tech-tech the logo by storing the correct values for $d016 and $d018 in the unrolled code, using for example a sinus table. The example code contains a routine which pre-calculates the $d016 and $d018 values from a sinus table for faster performance and another unrolled loop to store these values in the FLI-routine each frame, again for performance. 
 + 
 + 
 +===== The Code =====
  
-Using the so-called FLI techniquewe can trigger bad lines at every raster lineallowing us to manipulate the videoram pointer at every raster line+Here'the actual source code, in 64tass syntax. The FLI routine needs to be unrolledthe sinus calculation can all be done in a loopbut that eats cycles, so I also wrote some unrolled code for the $d016/$d018 values updating.
  
-       +Before assembling, one should probably comment out the references to the music, I would be surprised to see everyone having their HVSC at "/home/compyx/c64/HSVC" ;)
  
 <code 6502tasm> <code 6502tasm>
base/techtech_fli.1461235970.txt.gz · Last modified: 2016-04-21 12:52 by compyx