xsharp.eu • Assembly in VO
Page 1 of 1

Assembly in VO

Posted: Fri Dec 10, 2021 5:04 am
by robert.pope
Probably a crazy question, in an area where I have no experience, but I figure I'll ask anyway...

Is there any way to write snippets of assembly in VO?

I need to do a bit of 64 bit arithmetic on some FILETIME structures (https://docs.microsoft.com/en-us/window ... e-filetime). Every forum post I read for C++ says that the C++ runtime has long contained support for 64 bit calculations on a 32 bit process. As far as I'm aware VO uses the C++ runtime (at least we ship it with our app), so I'm wondering if I might be able to directly access some of those instructions.

I know C++ has some support for embedding assembly (https://en.cppreference.com/w/cpp/language/asm), I don't suppose VO has some hidden feature to allow that, without essentially writing a virus?

I'll probably just end up providing the 64 bit arithmetic functions via a C++ DLL taking _WINULARGE_INTEGER structures as parameters. My first thought was to write a 64 bit adder in VO. I figured this might still be an interesting question to have answered, however.

Any other suggestions?
Cheers.

Assembly in VO

Posted: Fri Dec 10, 2021 6:31 am
by wriedmann
Hi Robert,
of course you can write a DLL in VO to use in X# or C#.
But be aware that VO is 32 bit only, so this limits your X# application to 32 bit too.
The only possibility to overcome this bitness gap is to build a COM module in VO and use that in X#.
But IMHO the .NET framework has much more possibilities than VO.
Wolfgang

Assembly in VO

Posted: Fri Dec 10, 2021 7:13 am
by robert.pope
Hi Wolfgang.

I need it to work the other way around. I'm planning to write a DLL in C++ or some other language to be able to perform arithmetic on 64bit numbers while in a 32 bit world. The C++ runtime apparently supports that. VO will call the DLL to perform any operations on the 64bit numbers.

C++ 64bit subtract for example:

Code: Select all

PCPP_API void sub64(ULARGE_INTEGER &num1, ULARGE_INTEGER &num2, ULARGE_INTEGER &result)
{
	result.QuadPart = num1.QuadPart - num2.QuadPart;
}
VO will interface using the _WINULARGE_INTEGER structure, but can only see it as 2xDWORD values.

Although I'm going with the DLL approach, I was still curious if I could somehow write assembly directly in the VO IDE.

Cheers.

Assembly in VO

Posted: Fri Dec 10, 2021 7:24 am
by wriedmann
Hi Robert,
as long as there is the possibility to call a C/C++ API, you can do that of course also in VO and don't need to write a C++ DLL.
On the VO side you have to deal with the structure as AFAIK there is no datatype for 64 bit numbers - or you can put that in a class and work with that one.
Wolfgang

Assembly in VO

Posted: Fri Dec 10, 2021 9:12 am
by robert
Robert,
robert.pope wrote:Hi Wolfgang.
Although I'm going with the DLL approach, I was still curious if I could somehow write assembly directly in the VO IDE.
A long time ago there was a project call NASM (Nantucket Assembler) . This was something that Ralf Saborowski did.
This allowed you to store assembly source code in your VO repository and link the assembled code with your VO EXE/DLL.
Maybe you can find information about that in old conference notes or on the web.

Robert

Assembly in VO

Posted: Fri Dec 10, 2021 9:40 am
by FFF
IIRC, that should have been at Devcon 98. Was rather cool, it was enough to add a "NASM" in front of you method deklaration...

Assembly in VO

Posted: Fri Dec 10, 2021 11:30 am
by Karl-Heinz
Guys,

in the SDT 04/1999 there´s an article from SABO about NASM.

If anyone is interested, take a look at Frans Wauters VO site and search for filenames like 'NASM'.

https://vo.wautersit.com/pubcavo

btw. There are even patches available for VO 1.0 ;-)

regards
Karl-Heinz

Assembly in VO

Posted: Sat Dec 11, 2021 9:17 pm
by Plummet
Hi Robert and anyone else that is interested,
Attached is a version of NASM for VO 2.8 from Frans de Witt (found in my extensive archives).
And no, I have never tried to use it myself.
Good luck :)
Don