S
sysop50
Guest
Hi there.
I'm trying to create a DLL using assembly (FASM) but I'm having some issues.
First I create a buffer in GMS, poke in some values (chars 49, 50 and 51 - or '1' '2' and '3'), and get its address (pointer) in mem that I send to the DLL function via a string argument.
In the DLL function I get that address, poke in some new values and return to GMS where I check to see if everything went ok.
Well, it didn't. It doesn't change the values.
I checked in the DLL function and everything seems to be fine - I get the string pointer (that point to the pointer address - so a pointer in a pointer thing ). I tested with printing out the values while being in the DLL and both when I first get the pointer(s) and after I change the values are correct. But not when I return to GMS.
Here's the code in GMS:
buffer_poke(b,0,buffer_u8,49) // 1
buffer_poke(b,1,buffer_u8,50) // 2
buffer_poke(b,2,buffer_u8,51) // 3
blow(adr)
print(buffer_peek(b,0,buffer_u8)) // print() is just a script for show_debug_message(string(value))
print(buffer_peek(b,1,buffer_u8))
print(buffer_peek(b,2,buffer_u8))
Here's the FASM code:
proc Blow buf
mov BYTE [buf],71
inc [buf]
mov BYTE [buf],72
inc [buf]
mov BYTE [buf],73
ret
endp
FASM automatically push and pop the registers when using this, so 'buf' is really just another word for eax register.
But it's not working, the actual buffer does not get affected at all with this. What am I missing??
I'm trying to create a DLL using assembly (FASM) but I'm having some issues.
First I create a buffer in GMS, poke in some values (chars 49, 50 and 51 - or '1' '2' and '3'), and get its address (pointer) in mem that I send to the DLL function via a string argument.
In the DLL function I get that address, poke in some new values and return to GMS where I check to see if everything went ok.
Well, it didn't. It doesn't change the values.
I checked in the DLL function and everything seems to be fine - I get the string pointer (that point to the pointer address - so a pointer in a pointer thing ). I tested with printing out the values while being in the DLL and both when I first get the pointer(s) and after I change the values are correct. But not when I return to GMS.
Here's the code in GMS:
buffer_poke(b,0,buffer_u8,49) // 1
buffer_poke(b,1,buffer_u8,50) // 2
buffer_poke(b,2,buffer_u8,51) // 3
blow(adr)
print(buffer_peek(b,0,buffer_u8)) // print() is just a script for show_debug_message(string(value))
print(buffer_peek(b,1,buffer_u8))
print(buffer_peek(b,2,buffer_u8))
Here's the FASM code:
proc Blow buf
mov BYTE [buf],71
inc [buf]
mov BYTE [buf],72
inc [buf]
mov BYTE [buf],73
ret
endp
FASM automatically push and pop the registers when using this, so 'buf' is really just another word for eax register.
But it's not working, the actual buffer does not get affected at all with this. What am I missing??