insns.pl: smarter handling of operand flags
[nasm/sigaren-mirror.git] / test / cofftest.c
blob77f610fc7cbeedb86b79cd2081a7860a0415ecdf
1 /*
2 * test source file for assembling to COFF
3 * build with (under DJGPP, for example):
4 * nasm -f coff cofftest.asm
5 * gcc -o cofftest cofftest.c cofftest.o
6 */
8 #include <stdio.h>
9 #include <inttypes.h>
11 extern int lrotate(int32_t, int);
12 extern void greet(void);
13 extern int8_t asmstr[];
14 extern void *selfptr;
15 extern void *textptr;
16 extern int integer, commvar;
18 int main(void)
21 printf("Testing lrotate: should get 0x00400000, 0x00000001\n");
22 printf("lrotate(0x00040000, 4) = 0x%08lx\n", lrotate(0x40000, 4));
23 printf("lrotate(0x00040000, 14) = 0x%08lx\n", lrotate(0x40000, 14));
25 printf("This string should read `hello, world': `%s'\n", asmstr);
27 printf("The integers here should be 1234, 1235 and 4321:\n");
28 integer = 1234;
29 commvar = 4321;
30 greet();
32 printf("These pointers should be equal: %p and %p\n", &greet, textptr);
34 printf("So should these: %p and %p\n", selfptr, &selfptr);