NASM 0.98.16
[nasm.git] / test / aouttest.c
blob9a8eba303c27310c85eacb340f6e02b147e3a006
1 /*
2 * test source file for assembling to a.out
3 * build with:
4 * nasm -f aout aouttest.asm
5 * gcc -o aouttest aouttest.c aouttest.o
6 * (assuming your gcc is a.out)
7 */
9 #include <stdio.h>
11 extern int lrotate(long, int);
12 extern void greet(void);
13 extern char asmstr[];
14 extern void *selfptr;
15 extern void *textptr;
16 extern int integer, commvar;
18 int main(void) {
20 printf("Testing lrotate: should get 0x00400000, 0x00000001\n");
21 printf("lrotate(0x00040000, 4) = 0x%08lx\n", lrotate(0x40000,4));
22 printf("lrotate(0x00040000, 14) = 0x%08lx\n", lrotate(0x40000,14));
24 printf("This string should read `hello, world': `%s'\n", asmstr);
26 printf("The integers here should be 1234, 1235 and 4321:\n");
27 integer = 1234;
28 commvar = 4321;
29 greet();
31 printf("These pointers should be equal: %p and %p\n",
32 &greet, textptr);
34 printf("So should these: %p and %p\n", selfptr, &selfptr);