-
Inline asm problem.
Why won't it work?
Code:
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
int myGetch(void)
{
union REGS regs;
regs.x.ah = 16;
int86(22, & regs, & regs); //ignore the spaces, this is to stop
return regs.x.al; //it doing ® grr...
}
int main(int argc, char *argv[])
{
int a = myGetch();
printf("%c",a);
return 0;
}
errors:
Code:
aggregate `union REGS regs' has incomplete type and cannot be initialized
-
As far as I know, ah and al are not members of union REGS. You should use ax, which is build up of al and ah.
-
For ah and al syntax is :
regs.h.ah = 16;