User Tools

Site Tools


base:dysp_d017

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
base:dysp_d017 [2016-04-22 13:55] – [Stretching the first and last sprite line] compyxbase:dysp_d017 [2016-04-22 14:14] compyx
Line 27: Line 27:
 Using the $d017 sprite stretching technique, we can make our sprites arbitrarily high, repeating each line of a sprite for as long as we like. This keeps our border opening routine simple. Using the $d017 sprite stretching technique, we can make our sprites arbitrarily high, repeating each line of a sprite for as long as we like. This keeps our border opening routine simple.
  
-==== Stretching the first and last sprite line ==== +Here's the routine, basically an adjusted FLD with side border opening and sprite stretching
- +The interesting part is the d017_table access, this allows use to stretch (or not) each line of each sprite
-The trick to variable Y-positioning is to stretch the first line of a sprite until we reach the Y-position where we want the sprite to display, then displaying 19 lines of the sprite, and then stretching the last line of the sprite until the loop ends. +
-This of course means we can only use 19 pixels high sprites, lines 0 and 20 are cleared so we don't see the stretched sprite data. +
- +
- +
-here's the routine, basically an adjusted FLD with side border open and sprite stretching: +
 <code 6502tasm> <code 6502tasm>
 ; The $d017 stretcher ; The $d017 stretcher
Line 69: Line 63:
 </code> </code>
  
-The interesting part is the d017_table access, this allows use to stretch (or not) each line of each sprite. This means we can +==== Stretching the first and last sprite line ==== 
 + 
 +The trick to variable Y-positioning is to stretch the first line of a sprite until we reach the Y-position where we want the sprite to display, then displaying 19 lines of the sprite (not stretching the sprite(s)), and then stretching the last line of the sprite until the loop ends. 
 + 
 +Suppose we would want to display three sprites, each one one pixel lower than the next. 'A' means sprite 0, 'B' sprite 1 and so onA[xx] means which line of the sprite we display, 00 is the empty sprite line which we use to stretch until we display the actual sprite data (00-19), line 20 is the empty line we use to complete the loop. 
 + 
 +<code> 
 +Sprites            $d017             Display 
 +---------------    --------------    --------------------- 
 +A00   B00   C00    %11111111  $ff 
 +A01   B00   C00    %11111110  $fe    AAA            
 +A02   B01   C00    %11111100  $fc    AAA  BBB 
 +A03   B02   C01    %11111000  $f8    AAA  BBB  CCC 
 +A04   B03   C02    %11111000  $f8    AAA  BBB  CCC 
 +...   ...   ...    %11111000  $f8    AAA  BBB  CCC 
 +A20   B19   C18    %11111001  $f9         BBB  CCC  
 +A20   B20   C19    %11111011  $fb              CCC 
 +A20   B20   C20    %11111111  $ff 
 +</code> 
 + 
 +=== Limitations ==== 
 + 
 +This of course means we can only use 19 pixels high sprites, lines 0 and 20 are cleared so we don't see the stretched sprite data. 
  
  
base/dysp_d017.txt · Last modified: 2016-04-26 13:52 by compyx