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!