View Full Version : Just Wondering

April 30th, 2003, 03:55
I was just wondering if anyone could develop an emulator with
Visual Basic,and if so, What about the results? :huh:

April 30th, 2003, 04:49
There are some GB, GBC & GBA emulators written in Visual Basic.
The reason is, Visual Basic doesn't have a real compiler, it
produces simple ****in' code. This means, its VERY slow. To run a GB emulator at full speed wich is written in VB you need 500Mhz as minimum.... However, VB is good for
"Normal" applications.

April 30th, 2003, 06:18
You can compile BASIC. You just need to find a compiler.

But yes, most BASIC code is run through an interpreter...

April 30th, 2003, 14:01
Visual Basic comes with compiler . It's not the main problem .I will just past here nice quote from vbSpec emulator (emulator of Spectrum written in VB) :

Q2. Why on earth would anyone want to write an emulator in Visual Basic?

There are lots of reasons why you wouldn't want to write an emulator in VB - the lack of any bitwise rotation operators means that relatively expensive (in terms of CPU time) integer division and multiplication has to be used instead of simple bit-shifts, there's no unsigned 16-bit integer type in VB which is inconvenient when it comes to emulating a Z80, VB is not very portable, and perhaps most importantly of all:- even compiled, optimised VB code calls DLL routines for many BASIC statements and functions as they are executed. The overhead of all of these DLL function calls, coupled with various other things such as intense parameter checking, means that code written in VB executes quite slowly when compared to equivalent algorithms written and compiled with, say, Visual C++ or Borland Delphi. So, to actually get on and answer the question "Why VB?", the three simple reasons are:
To be different (there's loads of publicly available Z80 emulation code written in C, C++, Assembler for various processors, and Delphi, but nothing else, to my knowledge, written in VB!)
To see how fast it would run (and indeed, to see if it would run at all!)
As a learning tool (this was certainly a great learning exercise for me, and hopefully the source will be of interest to the proliferation of VB programmers in the world, some of whom may not know any other programming language).
Although this project was originally intended simply as an exercise in seeing what was possible with VB, it has gradually become quite a well-featured emulator in it's own right. This is quite embarrassing to me, as I really would have written it in C or Delphi if I'd have realised people were actually going to use it!

I can only add to it,that you can only write Interpretive emulator with VB,for obvious reasons .

April 30th, 2003, 21:11
Originally posted by [email protected]
So the problem exists only in speed.Do you believe that in future
a compiler will be added or all will remain the same? :plain:

That isn't the problem! READ! There ARE BASIC compilers!

April 30th, 2003, 23:04
So the problem exists only in speed.Do you believe that in future
a compiler will be added or all will remain the same? :plain:

May 2nd, 2003, 03:06
[email protected] - ummm I'm not sure you know what Shadow Prince was citing.. anyhow VB is a compilor. However VB can't act as a compilor. A bit of trivia here, guess what the most comon language compilors are written in (including VB).
The next most common? Not pascal. It's actually prolog, because you can translate BNF statements directly into it. ANYHOW.

Interpretors read instructions and execute them Dynamic Recompilors read the instructions and write native code to execute them as efficiently as possible.