-
How do I do, in VB, this program that I built in C++/ASM:
I don't care if it's not Assembler, I just need it to do the same thing. DOS or Windows, it doesn't matter.
Code:
#include <dos.h>
#define byte char
enum BOOL { TRUE = -1, FALSE };
void ViewMode(BOOL GraphicsMode)
{
asm MOV AH, 00h
if(GraphicsMode) asm MOV AL,13h
else asm MOV AL,03h
asm INT 10h
}
void PutPixel(int X, int Y, byte Color)
{
asm {
MOV AX,0A000h
MOV ES,AX
MOV BX,[X]
MOV DX,[Y]
MOV AL,[Color]
MOV DI,BX
MOV BX,DX
SHL BX,6
SHL DX,8
ADD DI,BX
ADD DI,DX
MOV ES:[DI],AL
}
}
int main()
{
ViewMode(TRUE); // 320x200x8-bit color
PutPixel(50,50,1); // (50,50) Blue
PutPixel(50,100,2); // (50,100) Green
PutPixel(100,50,3); // (100,50) Cyan
PutPixel(100,100,4); // (100,100) Red
delay(5000); // 5-sec wait
ViewMode(FALSE); // Text-mode
return 0;
}
Here's what I've got so far:
:confused: HEEEEEELP!!!!! :confused:
-
You can run assembler code in vb by writing the assembler directly into a byte array If you make sure the interface is always 4 long integer values in and returns 1 long integer. then you can use the callwindowproc API using varptr(bytProgram(0)) as the first parameter and your four long values as the other four parameters. You have to write the interface yourself in assembler but you can use the long integers as pointers to other data types (VarPtr(variable) returns a long pointer to a variable)
I have no Idea what the assembler does I haven't got round to learning assembler yet and I don't think very many people on this site have) If you just put in words what your'e trying to do You'll get more of a response.