I am trying to figure out BASM so I am making a test function, in this case a simple DOS_Open function.
I've worked out how to make it work with different memory models, but the one thing I'd like to see how to do is how to get AX into the AHandle pointer. In this case my method is using mov to copy ax into handle, and then use a C command *AHandle=handle. Is there a better way to do this? I've tried multiple things, but it seems like I'm trying to assign ax to a pointer of a pointer maybe? What asm can I replace the two bold lines with?
I've worked out how to make it work with different memory models, but the one thing I'd like to see how to do is how to get AX into the AHandle pointer. In this case my method is using mov to copy ax into handle, and then use a C command *AHandle=handle. Is there a better way to do this? I've tried multiple things, but it seems like I'm trying to assign ax to a pointer of a pointer maybe? What asm can I replace the two bold lines with?
Code:
int DOS_Open(char *AFilename, unsigned char AAccess, int *AHandle)
{
int handle;
#if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
asm push ds
asm lds dx, AFilename
#else
asm mov dx, AFilename
#endif
asm mov al, AAccess
asm mov ah, 0x3d
asm int 0x21
#if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
asm pop ds
#endif
asm jc fail
[b] asm mov handle, ax
*AHandle=handle;[/b]
//asm mov AHandle, ax
return 0;
fail:
return -1;
}