H. Peter Anvin | ea6e34d | 2002-04-30 20:51:32 +0000 | [diff] [blame^] | 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 | */ |
| 7 | |
| 8 | #include <stdio.h> |
| 9 | |
| 10 | extern int lrotate(long, int); |
| 11 | extern void greet(void); |
| 12 | extern char asmstr[]; |
| 13 | extern void *selfptr; |
| 14 | extern void *textptr; |
| 15 | extern int integer, commvar; |
| 16 | |
| 17 | int main(void) { |
| 18 | |
| 19 | printf("Testing lrotate: should get 0x00400000, 0x00000001\n"); |
| 20 | printf("lrotate(0x00040000, 4) = 0x%08lx\n", lrotate(0x40000,4)); |
| 21 | printf("lrotate(0x00040000, 14) = 0x%08lx\n", lrotate(0x40000,14)); |
| 22 | |
| 23 | printf("This string should read `hello, world': `%s'\n", asmstr); |
| 24 | |
| 25 | printf("The integers here should be 1234, 1235 and 4321:\n"); |
| 26 | integer = 1234; |
| 27 | commvar = 4321; |
| 28 | greet(); |
| 29 | |
| 30 | printf("These pointers should be equal: %p and %p\n", |
| 31 | &greet, textptr); |
| 32 | |
| 33 | printf("So should these: %p and %p\n", selfptr, &selfptr); |
| 34 | } |