Quick Search for:  in language:    
FPS,IDE,BTW,TNT2,Well,guys,ready,real,speed,R
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,011,557. lines
 Jobs: 117. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for Visual Basic.
Files Comperator (the right way)
By Jarry Claessen on 6/30


Simple UDP example
By Mick Walton on 6/30


CAPS Trigger
By Trevor Burley on 6/30


Auto clip picture
By Kenneth. Jakobsen on 6/30


Click here to see a screenshot of this code!Game of life clone (cool math)
By Johannes B on 6/30

(Screen Shot)

String to CHR()
By Nikhil Raj on 6/30


Encryption Decryption Demo
By Nikhil Raj on 6/30


Click here to see a screenshot of this code!Serial Registration
By Christian (eXonite Team) on 6/30

(Screen Shot)

AniViewer
By Jerrame Hertz on 6/30


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

ASM+VB = VB Hardcore. REALTIME Picture Fade In/Out

Print
Email
 
winzip icon
Submitted on: 10/1/2000 11:28:26 PM
By: Dmitry Apukhtin  
Level: Advanced
User Rating: By 41 Users
Compatibility:VB 6.0

Users have accessed this code 18581 times.
 
 
     Well, guys, are you ready for real speed? Real-time TRUECOLOR software-only picture pixel-by-pixel processing (no hardware accelerator stuff) in BACKGROUND, 50+ FPS of truecolor 640x480 image fade in/out with transparent full-area text scrolling - all in VB source, no DLL/OCX's - is it possible? Of course NOT :) Until you inject some assembler (machine codes) into it;-) Yes, hell working machine codes drive this sample, as well as some tricks abount DIB-images processing. Although nothing special in app itself (just slide show fading pics in and out) and you could get more fascinating stuff from DirectX, BUT! It's all in VB and works in IDE almost as fast as in compiled EXE. So, take a look at this stuff. And I hope you won't vote it "poor" just because "I don't f@%$ understand how the hell it could be!" :-) The code is real VB hardcore. So, gimme ur "wow!" ;-) BTW, that FPS was on my PII-400/RIVA TNT2. I wonder what's yours? Let me know!

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzipto decompress it.

Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:
1)Re-scan downloaded files using your personal virus checker before using it.
2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
3)Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 2 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
10/2/2000 12:57:06 AM:Warren
I didn't look at the code, but just ran 
the exe. Fading runs very smooth. I got 
about 60 fps, but I have a old voodoo 3 
card. Well done!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/2/2000 2:14:53 AM:Asmodeus
It took me a while, but I think I 
finally see what this is doing.. far 
out stuff.. am i reading this right.. 
are you converting the .asm into its 
native hex code?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/2/2000 5:22:20 AM:Ulli
It would be nice to have the ASM code 
included in the source. Otherwise a 
great idea. How do you pass Paramters 
to the ASM stuff ?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/2/2000 1:26:13 PM:Simon Price
I don't understand assembler, and I 
don't understand how you use VB and 
assembler together either. But I do 
understand that 50 FPS alpha blending 
is cool. Well done man.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/2/2000 8:11:55 PM:BRL
hey, Dmitry Apukhtin ... where do you 
live?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/3/2000 12:23:44 AM:Justin Boxwell
sir, you truly are the king of kings
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/3/2000 2:20:21 AM:Richard Petithory
This is very interesting and could be 
extremely usefull, but even for fairly 
experienced VB programmers, it is 
extremely cryptic. I give it an 
excellent rating because that is what 
it is, but I frown upon your 
commenting. It seems to me that a post 
like this to a site like this is more 
showing off than it is a helpfull 
tutorial... I am bitching because I 
would love to know how this works, but 
I'm afraid that even with a good 
ammount of time put in, I will still 
not understand it. I'm sure others feel 
the same way. Anyway, extremely good 
job - I would like to learn from 
it.
if you have any sort of further 
information on the web on how to start 
out something like this, or could 
possibly forward us (PSC users) to more 
information, please do so. Thanks!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/3/2000 4:01:42 AM:Richard Petithory
I'm not sure if the author is going to 
read this or not... I've been looking 
over the code for a while now (its 4 in 
the morning) and I understand the logic 
behind it... copying the instructions 
you formed into memory, but what I do 
not understand is where the strings you 
use in the 'XFade' sub, the 'RMChar' 
sub, etc. come from.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/3/2000 5:23:01 AM:michael
Hello Dmitry,
I mean this is a good 
job.
I give you a Excellent rating for 
this job but I´m not understand the 
code.
Make new Examples and we can 
learn from you :-)
>
Regards Michael
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/3/2000 12:17:56 PM:Kamilche
Ow, your code hurt my head. :-P 
The 
code ran at 10 fps on my 233 mhz 
Pentium II running Windows 95, 256 megs 
ram.
I have concerns about how 
portable to different machines it is, 
considering it's done in assembler. In 
addition, the speed is quite good 
enough to use for games (at least for 
older machines.)
In short, it's 
great that you managed to do assembler 
in VB, but ... why bother? :-P I can 
get > 100 fps on this machine, using 
DirectX and DirectDraw (but not doing 
alpha fades.) Show me a fast 
replacement for GDI transparent 
blitting, that doesn't use DirectX, and 
I'll sit up and take a closer look.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/3/2000 1:43:13 PM:rokinroj
I gave you a vote of excellent because 
yours is one of the first, if not the 
first post of its kind.  And as always 
we should award original ideas and not 
the same tired mp3 players or message 
box makers that get submitted every 
day.  The code is clearly out of my 
league, but it ran flawlessly at 50 
fps, and looks great! 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/4/2000 12:40:50 PM:Dmitry Apukhtin
hey guys thanx for comments.
in fact, 
I was going to describe technique of 
this "technology" (incapsulating 
machine codes in VB) step by steb, 
including debugging VB stuff in VC IDE, 
but wanted to see first if it worth to, 
if there are enough understanding and 
eager people. I won't say so far... sad 
truth is that people that are able to 
"communicate" with PC on this level are 
usually C-guys, not VB... or maybe it 
was wrong place to post to...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/4/2000 12:41:42 PM:Dmitry Apukhtin
anyway, Warren,Simon,Justin (especially 
:), michael,rokinroj - thanx 
guys!
BRL - why? 8-) wanna tell me 
in face what do you think about me? 
hehe :)
Richard - my respects. you 
are that kind of programmers I was 
counting on posting this stuff. hope 
you enjoyed breaking apart this sample 
:) "these string" came from native 
assembler code-bytes. in short: I write 
and debug asm procedure in VC 
environment and then do convert 
resulting bytes (machine codes) into 
their hex representations - each pair 
of chars in these strings are one code 
byte actually. keep going! RTFM! MSDN 
is the only and best source on 
knowledge in MS-world.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/4/2000 12:42:29 PM:Dmitry Apukhtin
Ulli - thanx man for first real 
question. that's not problem, in fact,  
I do not _pass_ parameters :) it's VB 
compiler's business to generate calling 
code which PUSH'es stuff in stack, I 
just pull DWORD's from stack and use 
them in asm code. for example, first 
param are in stack by [ESP+4], second - 
[ESP+8] etc so I do "mov EAX,[ESP+4]" 
etc. as for ASM source - man, what for? 
besides that it is as simple as 
lodsb/mul/stos in loop (for xFade 
proc), the point of this post wasn't to 
show cool asm tricks.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/4/2000 12:43:56 PM:Dmitry Apukhtin
Kamilche - oh, boy. why bother??? sorry 
(nothing personal_ - but why bother 
writing lame comments, tell me. he 
could make 100 fps not doing 
a/blending. huh. u know what, I could 
do 1000fps bouncing one pixel around. 
so what? u couldn't even notice that 
since most VGA cards runs max 120Hz of 
V/refresh rate. go buy your next 3D 
accel and tell everyone how'd _you_ 
make your 100 fps. oh, men. you didn't 
even realize that this post wasn't 
about pictures nor animations.
ok, 
too much typing for today :)
sorry for 
my poor english, if any.
thanx 
everybody
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/4/2000 12:50:48 PM:Michael Isaac
This is a good example.  If possible I 
would like you to create a more 
detailed example on how to copy asm 
code to the memory, hows it works and 
how it relates to vb.  Good code.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/4/2000 8:45:27 PM:Digital Paradigm
Very cool and very fast!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/6/2000 3:29:30 AM:Rings
Interresting Project.I've also 
coded
in ASM since DOS-Times.How do 
you extract the Hex-values out of the 
ASM-Code ?  MOVEB AL,BL  = ????
JMP 
ADRESS  = ????
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/6/2000 3:07:29 PM:Nathan Evans
This is quite good..
only i got ~20fps 
on my computer..
I have an athlon 
700, gforce 256..
It may be because 
i was running win2k at the time of the 
test, and since the gfx support isnt 
very good..
I'll try it on win98 and 
see how it goes..
It appeared to 
flicker at a very very fast rate as 
well..
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/6/2000 5:03:52 PM:Dmitry Apukhtin
Nathan, switch your display colors to 
more than 256
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/12/2000 4:18:52 AM:NLS - Nonlinear Solutions
Let me note some things ...
* This 
stuff is not all that mysterious, the 
techniques used have been around for 
some years (compare the work of David 
Brebner or my alphablitter at 
www.inode.at/nls)
* There is a great 
source on ASM+VB, the site of Patrice 
Scribe at www.chez.com/scribe
* As 
long as the assembler code hasnt been 
optimized to use MMX instructions like 
quadmoves or PIII specifics, it should 
run on any Pentium (eg, my latest ASM 
alpha engine uses MMX and therefore 
only runs on PII or above)
* Anyway, 
great work, you've got my vote, though 
I would appreciate a look at your ASM 
code (difficult to evaluate just how 
good youve done w/o it) 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/16/2000 7:42:12 AM:Fredrik Qvarfort
For everyone that wants the ASM code 
(which is missing here) you can 
download the NASM disassembler 
from
ftp://ftp.simtel.net/pub/simteln
et/msdos/asmutl/nasm097s.zip
then 
you can run the ndisasmw -u asmcode.asm 
> asmcode.txt
where asmcode.asm is a 
textfile with the machine code (this is 
the hexadecimal values, converted to 
binary data, in the asm class file).
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/17/2000 7:08:46 PM:Jean-Philippe Leconte
I've been doing enough assembler to 
understand what ur doing... copying 
binary asm to memory and replacing 
methods adresses by the adresses of 
your asm... really neat :) people 
should add more code like this... I had 
already tried replacing proc bodies, 
but had a lot of problems... your 
solution is fast enough for me... now I 
bang my head on the wall not having 
thought of it before ;P
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/30/2000 9:56:45 AM:KRAPHICS
You did goooooooood man.
Your code 
knocked me off my feet.
I found the 
code surfing for image processing code 
for VB. Your code will forever be a 
friend of mine.
Do some more.........
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/1/2000 7:45:27 AM:Linguar
After looking at this procedure, and 
with my limited knowledge of API, I see 
what you're doing...
It's nice 
work.
Couldn't someone use something 
similar to this In Visual Basic to 
script parts of games and convert them 
to Machine code and directly run them 
(after being converted to the correct 
hexadecimal base, of course)?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/1/2000 11:13:32 AM:CovertLoop
Sorry, bro, but the fading sucked.  Too 
much flicker going on.  Look at it from 
a Users point of view.  The Users don't 
give a rat's a§§ about what you did 
with your coding and/or converting.  
They're going to look at it and say to 
themselves ''What's the deal with the 
flickering?''.  Fix the flicker, and 
you've got it.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/1/2000 1:44:30 PM:Jon Furner
I understand how it works, but I have 
one question: How can I learn Assembly? 
I have been programming VB for 5 years, 
and I learned C. I think that this is 
just what VB needs, but I don't know 
how to do it. Not very many resources 
are just lying around any more. It 
makes it hard for those of us that are 
curious.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/1/2000 3:53:47 PM:Michael L. Barker
wow just because you asked ;) Nice job.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/1/2000 5:14:07 PM:Brian G.
Get a book on assembler for $50 it is 
hard reading but you will learn allot. 
I have a feeling this code uses a 
windows API call called by machiene 
code. I haven't looked at example yet. 
By the way, I am a c++ programmer.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/1/2000 8:51:08 PM:elaias
For those of you that want to wrap you 
gray matter around ASM, you can go to 
the guru of ASM's online book at: 
http://webster.cs.ucr.edu/Page_asm/Artof
Assembly/ArtofAsm.html . And for those 
of you who can't stay online you can 
follow the links to the main page and 
download the PS version. 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/7/2001 3:06:31 PM:Anonymous
I think this code is horrible because I 
replaced your pictures with my own 
pictures, and when your program faded 
them, the pictures looked so bad, they 
looked all streached and corrupted.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/14/2001 1:12:49 AM:Nick Behel
I saw your comment of explaining how 
this works in detail above. I have 
lately become interested in this type 
of stuff and would appreciate if you 
did explain it all. I got a solid 60 
fps on my athlon950 w/gforce2 and 
256megs of ram no problem. Great idea. 
nickbehel@aol.com
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/8/2001 3:24:05 AM:easfw
i must say this is truly fascinating.  
it's something i've been wanting to 
learn but looks too complicated
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/8/2001 3:26:38 AM:easfw
oh yeah i get about 9fps on this k6-2 
500 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/7/2002 7:10:11 AM:Cod3r
Interesting hack, you have my respect.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/10/2002 11:36:38 PM:James Dougherty
All I got to say is.... WHEW yes 
headache   :)  good job.. *ouch*  
-James-
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/26/2002 2:08:44 PM:Philip Kocanda
I am just started Visual Basic 6. I am 
always looking around on this site to 
find something nice to use in my app's 
and i found this! It is veary 
good!
Thanks!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/13/2002 2:18:46 AM:Carlos
usualy i d'ont vote but,
This one is 
AWESOME
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/5/2002 3:21:59 AM:Jim Dutcher
These techniques are obsolete. Assembly 
is ancient, please let go of the past...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/16/2002 2:47:45 AM:Josh Yu
Okay, Wow! ... I'll wallow myself in 
the code later.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/8/2002 7:36:36 PM:David Fritts
Jim Dutcher, your a crack head, 
assembly is still used today, all these 
other languages like VB and C++ are 
just compiled into an assembly, so plz 
shh and learn
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/3/2002 2:28:13 PM: KamiElder
correction: VB is not compiled into asm 
:-)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/13/2002 2:11:01 AM:Barry Taylor
Excellent code mate, well done,  i  
cant wait till im that good, how long 
does it take to become that good? email 
me the answer please and i will 
appreciate it ,
Thanks guys
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/2/2003 6:45:32 PM:David J. Fritts
The computer only knows how to execute 
machine code, thus, every language is 
converted to machine code and then 
executed.  This includes visual basic.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.