flat assembler
Message board for the users of flat assembler.
Index
> DOS > Fade in/out |
Author |
|
vid 08 Jan 2008, 00:16
to get reversed effect, just do this:
Code: ;cl = 8*(32 - fadetime) = 256 - 8*fadetime = - 8*fadetime mov cl, [fade_time] shl cl, 3 neg cl ;ESI = backbuffer ;EDI = front buffer ;color mov al, byte [esi] ;any part of RGB sub al, cl jnc .ok mov al, 0 .ok: mov byte [edi], al |
|||
08 Jan 2008, 00:16 |
|
DOS386 08 Jan 2008, 01:25
Quote: But to fade in, you can not do this, so far i have tryed shr 8 though to 0, with delay in between, but because there only 8 jumps instead of 32, it look abit jumpy. Trivial (but untested): You need 2 buffers. Walk through "frontbuffer" and "backbuffer" parallelly ... pick value from "front", add 1 (or 8 or whatever), compare with "back", avoid that new value exceeds "back" value (reduce if necessary), count successful additions, write back to "front", next pixel, after one pass, abort if no successful additions done in last pass, delay, loop. PS: This algo should not rely on stupid "Ms-DOS" (evidence pending ) _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
08 Jan 2008, 01:25 |
|
LocoDelAssembly 08 Jan 2008, 01:34
Code: sub al, cl jnc .ok mov al, 0 .ok: Code: mov dl, $ff sub al, cl adc dl, 0 and al, dl Code: sub al, cl sbb dl, dl not dl and al, dl It is just to try to make the time constant but I'm not sure if the overall performance will be better with ADC BTW, is correct that NEG? |
|||
08 Jan 2008, 01:34 |
|
vid 08 Jan 2008, 02:04
i didn't test or optimize that code, it was just an idea written dow as assembly pseudo-code
|
|||
08 Jan 2008, 02:04 |
|
Dex4u 08 Jan 2008, 06:33
vid wrote: i didn't test or optimised that code, it was just an idea written dow as assembly pseudo-code Well your pseudo-code worked great, thank vid And thank to everyone that answer and i will give your optimised code a test LocoDelAssembly and report back. |
|||
08 Jan 2008, 06:33 |
|
Vov4ik 08 Jan 2008, 09:37
It would be faster, if source image is placed not in video RAM, but in the main memory, because VRAM is optimized for writing, not for reading. And you didn't mention if you use bank switching or linear fideo buffer. Linear buffer is faster, it is especially appreciable on dynamic images.
|
|||
08 Jan 2008, 09:37 |
|
Dex4u 08 Jan 2008, 17:48
Thanks for the info Vov4ik, but i do have the main image in main memory and l use LFB.
|
|||
08 Jan 2008, 17:48 |
|
vid 08 Jan 2008, 18:16
AFAIK It's best to have both and backbuffer in frontbuffer in video RAM, and just flip() between them. I think I've rad that writing to "active" video ram is much slower than to rest of it.
It may not be best case for fading, but fading seldom needs to be very fast these days... it's time/bound, not CPU bound |
|||
08 Jan 2008, 18:16 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.