|
From: Anita P. <lis...@bi...> - 2002-06-08 12:38:09
|
Hi folks, I have a problem for any of you inline assembler gurus:
I have been using DJGPP for years, and recently switched to Dev-C++ which I
instantly loved, but found
that a few functions I relied heavily on for console work don't exist:
clrscr, gotoxy, readkey and clreol.
I wrote using inline assembler within macros replacement functions which
compiled and ran fine on a copy of
DJGPP but upon using them in the MinGW compiler I get a weird problem.
Simply that it compiles without a
hitch (even with the -Wall switch) but upon running crashes after the very
first macro call.
I have included the clrscr() macro and a short version of my driver program
as an example hoping someone can point
me in the right direction. (Excuse the VERY primative debugging used, but I
haven't got the hang of most interactive
debuggers)
#define clrscr() \
asm("movw $0x0600, %ax \n\t" \
"movb $7, %bh \n\t" \
"movw $0x0000, %cx \n\t" \
"movw $0x184f, %dx \n\t" \
"int $0x10" );
int main(void)
{
FILE *smegfile;
int count;
char key;
#ifdef DEBUG
smegfile = fopen("smeg.txt", "wt");
fprintf(smegfile, "START\n");
fclose(smegfile);
#endif
clrscr();
#ifdef DEBUG
smegfile = fopen("smeg.txt", "wt");
fprintf(smegfile, "CLRSCR()\n");
fclose(smegfile);
#endif
return 0;
}
output in smeg.txt:
START
Cheers
Stuart Downing
|