diff --git a/include/rp6502.h b/include/rp6502.h index b51382825..d40ba8a88 100644 --- a/include/rp6502.h +++ b/include/rp6502.h @@ -133,14 +133,14 @@ long __fastcall__ ria_call_long (unsigned char op); /* C API for the operating system. */ typedef struct { - unsigned long fsize; /* File size (invalid for directory) */ - unsigned fdate; /* Date of file modification or directory creation */ - unsigned ftime; /* Time of file modification or directory creation */ - unsigned crdate; /* Date of object createion */ - unsigned crtime; /* Time of object createion */ - unsigned char fattrib; /* Object attribute */ - char altname[12 + 1]; /* Alternative object name */ - char fname[255 + 1]; /* Primary object name */ + unsigned long fsize; + unsigned fdate; + unsigned ftime; + unsigned crdate; + unsigned crtime; + unsigned char fattrib; + char altname[12 + 1]; + char fname[255 + 1]; } f_stat_t; int __cdecl__ xregn (char device, char channel, unsigned char address, unsigned count, @@ -157,8 +157,11 @@ int __fastcall__ write_xram (unsigned buf, unsigned count, int fildes); long __fastcall__ f_lseek (long offset, int whence, int fildes); int __fastcall__ f_stat (const char* path, f_stat_t* dirent); int __fastcall__ f_opendir (const char* name); -int __fastcall__ f_readdir (f_stat_t *dirent, int dirdes); +int __fastcall__ f_readdir (f_stat_t* dirent, int dirdes); int __fastcall__ f_closedir (int dirdes); +long __fastcall__ f_telldir (int dirdes); +int __fastcall__ f_seekdir (long offs, int dirdes); +int __fastcall__ f_rewinddir (int dirdes); /* Time zone hack */ diff --git a/libsrc/rp6502/f_closedir.c b/libsrc/rp6502/f_closedir.c index 03239c874..279483ca9 100644 --- a/libsrc/rp6502/f_closedir.c +++ b/libsrc/rp6502/f_closedir.c @@ -1,5 +1,4 @@ #include -#include int __fastcall__ f_closedir (int dirdes) { diff --git a/libsrc/rp6502/f_lseek.c b/libsrc/rp6502/f_lseek.c index da7c3dfdf..ada9baab5 100644 --- a/libsrc/rp6502/f_lseek.c +++ b/libsrc/rp6502/f_lseek.c @@ -1,5 +1,4 @@ #include -#include long __fastcall__ f_lseek (long offset, int whence, int fildes) { diff --git a/libsrc/rp6502/f_readdir.c b/libsrc/rp6502/f_readdir.c index f6fa42e1b..45777c221 100644 --- a/libsrc/rp6502/f_readdir.c +++ b/libsrc/rp6502/f_readdir.c @@ -1,8 +1,6 @@ #include -#include -#include -int __fastcall__ f_readdir (f_stat_t *dirent, int dirdes) +int __fastcall__ f_readdir (f_stat_t* dirent, int dirdes) { int i, ax; ria_set_ax (dirdes); diff --git a/libsrc/rp6502/f_rewinddir.c b/libsrc/rp6502/f_rewinddir.c new file mode 100644 index 000000000..bd2ebaa1b --- /dev/null +++ b/libsrc/rp6502/f_rewinddir.c @@ -0,0 +1,7 @@ +#include + +int __fastcall__ f_rewinddir (int dirdes) +{ + ria_set_ax (dirdes); + return ria_call_int (RIA_OP_REWINDDIR); +} diff --git a/libsrc/rp6502/f_seekdir.c b/libsrc/rp6502/f_seekdir.c new file mode 100644 index 000000000..5c6890e3d --- /dev/null +++ b/libsrc/rp6502/f_seekdir.c @@ -0,0 +1,8 @@ +#include + +int __fastcall__ f_seekdir (long offs, int dirdes) +{ + ria_set_ax (dirdes); + ria_push_long (offs); + return ria_call_int (RIA_OP_SEEKDIR); +} diff --git a/libsrc/rp6502/f_telldir.c b/libsrc/rp6502/f_telldir.c new file mode 100644 index 000000000..1396e0a88 --- /dev/null +++ b/libsrc/rp6502/f_telldir.c @@ -0,0 +1,7 @@ +#include + +long __fastcall__ f_telldir (int dirdes) +{ + ria_set_ax (dirdes); + return ria_call_long (RIA_OP_TELLDIR); +}