diff --git a/samples/stdio_test.c b/samples/stdio_test.c new file mode 100644 index 0000000..c6cad94 --- /dev/null +++ b/samples/stdio_test.c @@ -0,0 +1,40 @@ +#include +#include + + +void main(void) { + + FILE *fp = fopen("file.txt", "wb"); + + fclose(fp); +} + +// these stubs are not provided in the library but could call gs/os. + +int open(const char *name, int mode) { + return -1; +} + +int close(int fd) { + return -1; +} + +size_t read(int fd, void *buffer, size_t count) { + return -1; +} + +size_t write(int fd, void *buffer, size_t count) { + return -1; +} + +long lseek(int fd, long offset, int whence) { + return -1; +} + +int creat(const char *name, int mode) { + return -1; +} + +int unlink(const char *name) { + return -1; +} \ No newline at end of file diff --git a/samples/stdio_test.lst b/samples/stdio_test.lst new file mode 100644 index 0000000..d2b54ff --- /dev/null +++ b/samples/stdio_test.lst @@ -0,0 +1,347 @@ + Mon Jan 16 2017 11:21 Page 1 + + + *************************************** + ** WDC 65C816 Macro Assembler ** + ** ** + ** Version 3.49.1- Feb 6 2006 ** + *************************************** + + 1 ;:ts=8 + 2 00000001 R0 equ 1 + 3 00000005 R1 equ 5 + 4 00000009 R2 equ 9 + 5 0000000D R3 equ 13 + 6 ;#include + 7 ;#include + 8 ; + 9 ; + 10 ;void main(void) { + 11 code + 12 xdef ~~main + 13 func + 14 ~~main: + 15 longa on + 16 longi on + 17 00:0000: 3B tsc + 18 00:0001: 38 sec + 19 00:0002: E9 04 00 sbc #L2 + 20 00:0005: 1B tcs + 21 00:0006: 0B phd + 22 00:0007: 5B tcd + 23 ; + 24 ; FILE *fp = fopen("file.txt", "wb"); + 25 ; + 26 ; fclose(fp); + 27 00000000 fp_1 set 0 + 28 00:0008: F4 xx xx pea #^L1+9 + 29 00:000B: F4 xx xx pea #