diff --git a/testcode/lib/ft.c b/testcode/lib/ft.c new file mode 100644 index 000000000..e62a32517 --- /dev/null +++ b/testcode/lib/ft.c @@ -0,0 +1,108 @@ +/* + * simple file i/o test + * + * 12-Jun-2000, Christian Groessler + * + * please compile with + * cl65 -tsystem ft.c getsp.s -o ft.com + * + * The program asks for a filename (if it hasn't + * got one from argv). I then opens the file, + * reads the the first 16 bytes and displays them + * (as hex values). + * The values of sp (cc65 runtime stack pointer) + * are displayed at some places. The displayed + * value should always be the same. + */ + +#include +#include +#include +#include +#include + +extern int getsp(void); /* is provided in getsp.s */ + +#ifdef __ATARI__ /* Atari's fd indirection table */ +extern char fd_index[]; +struct fd_t { + char usage; + char iocb; + char dev; + char flag; +}; +extern struct fd_t fd_table[]; +#endif /* #ifdef __ATARI__ */ + +int main(int argc,char **argv) +{ + char *filename,*x; + char buf[20]; + int i,l,lr; + int fd; + int csp; + + if (argc >= 2) { + filename = *(argv+1); + } + else { + printf("\nfilename: "); + x = fgets(buf,19,stdin); + printf("\n"); + if (!x) { + printf("nothing read\n"); + return(0); + } +#if 0 + l = strlen(x); + printf("read: "); + for (i=0; i