09-10-2003, 01:43 PM
I'm trying to code assembler statement in vb. Ive been successful in C++ and I've seen it been done in Turbo Pascal. Now I really need to get it working in VB beacuse my mane project is in vb and 'n dont want to get stuck on writing dll files to import (i dont think i quite know how!?)
the code I need to work is this ( as from successful C++ compilation);
_AH = 0x84;
_DX = 01;
just for the sake of understanding both ways, this is how I understand it:
values get read from a port and store in registers _AH and _DX. A sofrware interrupt is called. and register _AX is returned (btw, this would be a function returning an integer). Does equivalent code exist to perform this in vb? please help!
would be greatly appreciated
09-10-2003, 01:46 PM
VB has no native methods to inline assembly code. You'd be better off creating a C++ dll using _asm, or a pure ASM dll using masm32.
09-10-2003, 01:50 PM
appreciate the quick reply,
do you perhaps have a link/idea of wheer i can start looking at compiling dll's from C++ source code?
09-10-2003, 01:58 PM
All you really need is:
BOOL _stdcall DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpReserved)
And then whatever function(s) you want to export
int _stdcall MyFunction(int iFoo)
And a .DEF file containing the following
09-11-2003, 01:17 PM
hi there again, sorry to bother
i tried using the function types you gave me, but i keep getting a "syntax error in declaration". are there any libraries I should "#include" at the top.
using C++ 4.5 compiler.
thanx in advance
09-11-2003, 02:09 PM
yes, #include "windows.h", or you could just change HINSTANCE, DWORD and LPVOID to int, if you're just returning true.
09-19-2003, 02:13 PM
hey again, Im struggling somewhat. would appreciate some help.
I tried everything and more tha i got from you guys. The Cpp file as described in this post compiles successfully. I also created the .def file with my Export list (only on function). When however i try to compile the project as a whole to .dll file, I get "Your are trying to export a non-public symbol "<function name>". "
how do I then mark a function as begin exportable or make ot public. ?
thanks so long
09-19-2003, 06:46 PM
The code I posted works for VC++. What compiler are you using?
09-20-2003, 07:01 AM
I'm using a somewhat old compiler (i think). it's Borland's C++ ver 4.5
i hope its just syntax or fixable compiler issues i have. I do have the option to create a new Project as 32bit DLL, so I figure it must be possible.
09-24-2003, 03:23 AM
it will not be simple to generate interrupts in a 32-bit application. Interrupts are old-school stuff used back in the days of DOS and 16-bit programming. This particular BIOS interrupt function returns information from the joystick port. Specifically, its position.
AX = X position of joystick A
BX = Y position of joystick A
CX = X position of joystick B
DX = Y position of joystick B
I suggest you replace this offending function with a call to the DirectX joystick functions. I believe there are a few joystick programming tutorials for visual basic cluttering up the web.