| |
Flavioweb
Registered: Nov 2011 Posts: 463 |
Dma trick to flip bitmap.
it's possible, using some d011/18 manipulation to flip top/down a bitmap?
More in details, is possible to show, for eg, from raster line $33 to $42 as normal, then flip from $43 to $52 then show things as normal until end of screen?
If 'yes' ... How? |
|
| |
Repose
Registered: Oct 2010 Posts: 225 |
No, I don't think so, the fetch address is always incrementing and it would have to be a hardware feature to decrement it.
You might try defining an upside-down charset and switch between those at the right times.
I've seen reflection effects, but I assume they were just coded.
|
| |
algorithm
Registered: May 2002 Posts: 705 |
You can do this no problem via character mode but the height would be rather limited. using d018/dd00/d011 furthermore it would require a considerable amount of gfx space
Alternatively you can wobble and stretch bitmaps/FLI etc
If you want true bitmap flipping, then opt for the software only method, however having it run every frame would be unlikely unless bitmap area is small |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
it would help to know what exactly you want to do... some kind of FPP based routine could be used, for example. |
| |
Flavioweb
Registered: Nov 2011 Posts: 463 |
Quoting Groepazit would help to know what exactly you want to do... some kind of FPP based routine could be used, for example.
it'quite complicated to explain and it's actually only an idea, but i need to flip a portion of bitmap moving the effect from top to bottom, leaving at least, the part over the top of effect flipped correctly.
But i can't use a totally flipped image and split screen, because i need that only the part where effect is show to be flipped. So if i flip top part, with a totally flipped img to switch i have bottom part instead top part flipped... |
| |
Repose
Registered: Oct 2010 Posts: 225 |
I understand what you mean. You can't simply switch between two full-screen bitmaps, because you want only from Y1-Y2 to be flipped, for that part of the graphic only.
This can still be done with charsets.
In a typical arrangement, the letters
@P...{248}
AQ...{249}
BR...{250}
...
O{31}...{255}
.. etc. in a 16x16 charset bitmap.
You would have an alternate charset with flipped image data. To present the effect from Y1=8 to Y2=15, present:
@P
N{30} *Alternate charset active
BR
So, you are copying 16 bytes/row of effect, fetching the letter 15-N (you can figure out the formula, put it in a table). Then using a raster to change charsets from Y1-Y2.
If the effect moves down, slowly enough, you have to store 32 bytes/row of effect/screen. The effect is limited to mod(8) heights, however :(
You can also use a normal bitmap for most the screen, leaving the effect of size (256/40)=6 char-rows of max height for the effect area. This requires *duplicating* the image data of the bitmap, into the charsets. The area duplicated is also limited; meaning that Yn can only vary +-3 rows of some part of the graphic. For example, if the effect is 8 lines high, it could only occur over say the first 6 char-rows, unless you use even more charset memory.
You could also use line-crunching to do the 15-N idea, but with a full bitmap, but you couldn't return to normal again, because the un-flipped bitmap would now be line-crunched also.
Does the area of effect have to be completely flexible? My approach is quite limited.
Let's compare to pure data-copy. I think you have about 17,000 cycles/frame, that's time for 2100 bytes pure copy (LDA/STA), 53 lines or 6 chars! So software is actually better, if you use 100% CPU time.
|
| |
Flavioweb
Registered: Nov 2011 Posts: 463 |
i can also use 100% cpu time for the effect, because i have in mind to use this effect just as one-shot introduction for next part of routine. So no music or other things are involved.
I think that only 3/4 line height max are sufficient for my -idea-.
However i need to make this effect flowing down by 1 line at time, covering all bitmap height.
|
| |
Repose
Registered: Oct 2010 Posts: 225 |
Then that's easy,
calculation for byte in bitmap:
addr=int(y/8)*320+(y and 7)+int(x/8)*8
(int(x/8)*8=(x and 248))
base1=start addr of normal bitmap graphic data
base2=start addr of flipped bitmap
bitmap=VIC multicolor base address
x=x coordinate (not used)
y=y coordinate
You will use a table of 200*2 bytes for addr.
To flip from Y1 to Y2:
for j=(y2-y1)-1 to 0 step -1 'the height
addr_src=base2+table(199-y1-j)'flipped addr
addr_dst=bitmap+table(y+j)'bitmap addr
for i=39 to 0 step -8
poke addr_dst+i, peek(addr_src+i)
next i
next j
addr_src=base1+table(y1-1)'normal addr
addr_dst=bitmap+table(y1-1)'bitmap addr
for i=39 to 0 step -8
poke addr_dst+i, peek(addr_src+i) 'clean up line above
next i
This is valid for as long as effect is moving down. Skip 2nd part if y1=0, also ensure y2<=199 etc.
Start in top border. Requires 25k of data. You can save 4k by not storing some parts of the image where effect is not needed, ie only middle 150 lines in base1 and base2.
You do not need to keep all 25k on disk; only one bitmap (~9k) can be loaded, then copied normal and flipped, to base1 and base2.
|
| |
Monte Carlos
Registered: Jun 2004 Posts: 359 |
You can flip a bitmap without any tricks and without color clash if the mirror axis is in the middle of a character line. Maybe this could be of use for your effect.
Monte
|
| |
Repose
Registered: Oct 2010 Posts: 225 |
Oh, as far as color, you could scroly down while physically moving bitmap up, to get color split in a different line, relatively. You would have to work this through.
|