flat assembler
Message board for the users of flat assembler.
Index
> Windows > dll questions.. |
Author |
|
windwakr 30 Jun 2004, 23:19
Im pretty new to assembly and I have a couple of dll questions. I wanna make dlls for a program called Gamemaker but gamemaker only reads doubles. EX dev-c++ code:
Code: #define export extern "C" __declspec( dllexport ) export double add(double n1, double n2) { return n1+n2; } can you export doubles in FASM? O, and one more question. when i do invoke something like getsyscolor how do I put that in a var? btw: My first post here! |
|||
30 Jun 2004, 23:19 |
|
pelaillo 30 Jun 2004, 23:38
Welcome windwakr,
"double" in this case is an integer type with 32 bit size. What does it mean is that you get two 32bit values and return one. In assembly the type of the values is given by the size. A 32 bit value is called a DoubleWord or dword. One of the characteristics of win32 in 32 bit processors is that you wrtie faster and simpler programs if the values passed to functions and returned from them are dword values. The procedure in Fasm will look like: Code: proc add,n1,n2 enter mov eax,[n1] add eax,[n2] return endp For the rest of the code for the dll, give a look at http://board.flatassembler.net/topic.php?t=1760 |
|||
30 Jun 2004, 23:38 |
|
VitalOne 01 Jul 2004, 02:40
Hi, I use to use Game Maker (as VitalDragon, made the download DLL) and made other DLLs using FASM for Game Maker. You have to use FPU Instructions for GM (for some reason...) which are documented in the FASM PDF.
Code: format PE GUI 4.0 DLL entry DllEntryPoint include '%fasminc%\win32a.inc' section '.data' data readable writeable ans dq 0 section '.code' code readable executable proc DllEntryPoint, hinstDLL,fdwReason,lpvReserved mov eax,TRUE return endp proc add_asm,arg1,arg1a,arg2,arg2a fld [ans] fld qword [arg1] fadd qword [arg2] return endp section '.idata' import data readable writeable library kernel,"KERNEL32.DLL" import kernel,\ GetProcAddress,"GetProcAddress" section '.edata' export data readable export 'add.dll',\ add_asm,"add_asm" section '.reloc' fixups data discardable That's a simple example that adds two numbers. Since doubles are 64-bit, one double argument is two 32-bit arguments, (hence arg1,arg1a). Also if the DLL is less than 3.5KB Game Maker displays an error (?)... |
|||
01 Jul 2004, 02:40 |
|
windwakr 01 Jul 2004, 14:59
ok thanks for all the information!
btw:You were vitaldragon? |
|||
01 Jul 2004, 14:59 |
|
VitalOne 02 Jul 2004, 02:52
windwakr wrote: ok thanks for all the information! Yeah...I don't use that program much anymore though |
|||
02 Jul 2004, 02:52 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.