Post by Six on Dec 2, 2004 23:15:18 GMT -5
Tonight's project is linear video mode. When I first saw this phrase in the dtv docs, I thought to myself "What in the heck can that possibly be?".
To fully explain what linear mode is, a diagram/review is in order.
A normal C64 bitmap consists of pixels stored in 8-byte high stacks of 8 bits, in rows of 40 across the screen. If your bitmap starts at $2000, then they would be addressed as such:
$2000 $2008 $2010 ->all the way for 40 stacks
$2001 $2009 $2011
$2002 $200a $2012
$2003 $200b $2013
$2004 $200c $2014
$2005 $200d $2015
$2006 $200e $2016
$2007 $200f $2017
Needless to say, this byte arrangement is awkward to work with, and you consume many cycles trying to accomodate it.
Well, linear mode simplifies all of that.
In linear mode, bytes are arranged in rows of 40 each, from left to right. For instance, if your bitmap starts at $2000, then the pixels across the top row are in bytes $2000-$2027, the next row in bytes $2028-$204f, and so on.
There are many advantages to using linear mode. For one, you can have your bitmap located just about anywhere, without worrying about where your VIC page boundaries are. For another, scrolling in any direction is a piece of cake, simply change the address of your linear display!
To produce my linear bitmap, I created a 1-bit BMP and clipped off all of the BMP header. Don't forget to verticly invert your BMP, as it is encoded oddly.
At first, I thought something was wrong with my DTV. I had my bitmap at $0830, and there was a big scrambled spot in the middle of it. - This was character data at $1000 as seen in linear mode. Beware of this address range, as it is unusable in linear mode too.
I moved my bitmap to $2000 and all looked fine after that.
The linear mode modulo is broken. See the notes in the source about that. The only useful value seems to be 0, but 5 showed my pic at 1/2 height, and 10 showed it at 1/4 height, so there may be useful tricks that I'm missing.
In the example I have done, the DTV will display a bitmap in linear mode, and you may scroll around with the cursor keys.
Enjoy, and I hope you find this useful.
thedarkside.ath.cx/dtv/linear.zip
To fully explain what linear mode is, a diagram/review is in order.
A normal C64 bitmap consists of pixels stored in 8-byte high stacks of 8 bits, in rows of 40 across the screen. If your bitmap starts at $2000, then they would be addressed as such:
$2000 $2008 $2010 ->all the way for 40 stacks
$2001 $2009 $2011
$2002 $200a $2012
$2003 $200b $2013
$2004 $200c $2014
$2005 $200d $2015
$2006 $200e $2016
$2007 $200f $2017
Needless to say, this byte arrangement is awkward to work with, and you consume many cycles trying to accomodate it.
Well, linear mode simplifies all of that.
In linear mode, bytes are arranged in rows of 40 each, from left to right. For instance, if your bitmap starts at $2000, then the pixels across the top row are in bytes $2000-$2027, the next row in bytes $2028-$204f, and so on.
There are many advantages to using linear mode. For one, you can have your bitmap located just about anywhere, without worrying about where your VIC page boundaries are. For another, scrolling in any direction is a piece of cake, simply change the address of your linear display!
To produce my linear bitmap, I created a 1-bit BMP and clipped off all of the BMP header. Don't forget to verticly invert your BMP, as it is encoded oddly.
At first, I thought something was wrong with my DTV. I had my bitmap at $0830, and there was a big scrambled spot in the middle of it. - This was character data at $1000 as seen in linear mode. Beware of this address range, as it is unusable in linear mode too.
I moved my bitmap to $2000 and all looked fine after that.
The linear mode modulo is broken. See the notes in the source about that. The only useful value seems to be 0, but 5 showed my pic at 1/2 height, and 10 showed it at 1/4 height, so there may be useful tricks that I'm missing.
In the example I have done, the DTV will display a bitmap in linear mode, and you may scroll around with the cursor keys.
Enjoy, and I hope you find this useful.
thedarkside.ath.cx/dtv/linear.zip