Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Raylin on September 02, 2010, 11:53:24 am

Title: Cool transitions!
Post by: Raylin on September 02, 2010, 11:53:24 am
Yeah. Well, they would be if they worked.
I am trying to save a screen to the back-buffer and then call 8x8 chunks of that screen back to the screen.
How would I do that?
Title: Re: Cool transitions!
Post by: Deep Toaster on September 02, 2010, 12:01:56 pm
The back-buffer's stored in appBackUpScreen (L3) and the buffer's stored in plotSScreen (L6), so you could copy bytes over individually. Each one is a bitmap (like the ones you'd use for the Bitmap( command, except without the first two size bytes), so each row is represented by 12 pixels, and there are 64 (I think) rows total, like this:
Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte
█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █
 █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █
█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █
 █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █
█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █
 █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █
█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █
 █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █
......................................................

So to copy an 8x8 that happens to be in a perfect tile (meaning it doesn't cross one of those lines), all you'd have to do is copy one byte over from the first row, then one from the second row, then one from the third row, etc. (for eight rows).

For example, to copy the first 8x8 tile, you'd copy the first byte over to where you want it, then the byte twelve bytes after L3, then the byte at twelve after that, and so on.
Title: Re: Cool transitions!
Post by: Runer112 on September 02, 2010, 03:12:08 pm
I believe you meant to say one byte instead of two bytes? Each row of 8 pixels is only one byte, so you'd end up copying 8 rows of 1 byte each.

The screen is 96x64 pixels, so diving it up into 8x8 blocks would give you 12x8 blocks. The following routine, with inputs 0-11 (r1) and 0-7 (r2), would copy a block from the back buffer to the front buffer. r3 is used as a temporary variable.

Code: [Select]
Lbl B2F
For(r₃,0,7)
r₂*8+r₃*12+r₁→r₄+L₃→r₄+L₆
End
Return

EDIT: Oops, just realized I had L3 and L6 reversed.
Title: Re: Cool transitions!
Post by: Deep Toaster on September 02, 2010, 03:20:09 pm
I believe you meant to say one byte instead of two bytes? Each row of 8 pixels is only one byte, so you'd end up copying 8 rows of 1 byte each.

Whoops, yeah, sorry.