llvm-mos-sdk
Classes | Macros | Typedefs | Enumerations | Functions
file.h File Reference
#include <stdint.h>
#include <neo6502.h>
#include "types.h"
Include dependency graph for file.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  neo_file_stat
 

Macros

#define NEO_FILE_DESTINATION_GRAPHICS   ((void*) 0xFFFF)
 
#define NEO_FILE_ATTR_DIRECTORY   0x01
 
#define NEO_FILE_ATTR_SYSTEM   0x02
 
#define NEO_FILE_ATTR_ARCHIVE   0x04
 
#define NEO_FILE_ATTR_READ_ONLY   0x08
 
#define NEO_FILE_ATTR_HIDDEN   0x10
 

Typedefs

typedef enum neo_file_mode neo_file_mode_t
 
typedef struct neo_file_stat neo_file_stat_t
 

Enumerations

enum  neo_file_mode { NEO_FILE_READ = 0, NEO_FILE_WRITE = 1, NEO_FILE_READ_WRITE = 2, NEO_FILE_CREATE = 3 }
 

Functions

void neo_file_list_directory (void)
 Display the listing of files in the current directory. More...
 
void neo_file_load_p (const neo_pstring_t *filename, void *dest)
 Load a file into memory, using a Pascal string for the filename. More...
 
void neo_file_load (const char *filename, void *dest)
 Load a file into memory, using a C string for the filename. More...
 
void neo_file_store_p (const neo_pstring_t *filename, const void *src, uint16_t len)
 Store a file from memory, using a Pascal string for the filename. More...
 
void neo_file_store (const char *filename, const void *src, uint16_t len)
 Store a file from memory, using a C string for the filename. More...
 
void neo_file_open_p (uint8_t channel, const neo_pstring_t *filename, uint8_t mode)
 Open a file channel, using a Pascal string for the filename. More...
 
void neo_file_open (uint8_t channel, const char *filename, uint8_t mode)
 Open a file channel, using a C string for the filename. More...
 
void neo_file_close (uint8_t channel)
 Close a file channel. More...
 
void neo_file_seek (uint8_t channel, uint32_t pos)
 Seek a file. More...
 
uint32_t neo_file_tell (uint8_t channel)
 Tell a file's position. More...
 
uint16_t neo_file_read (uint8_t channel, void *dest, uint16_t len)
 Read bytes from an open file. More...
 
uint32_t neo_file_write (uint8_t channel, const void *src, uint16_t len)
 Write bytes to an open file. More...
 
uint32_t neo_file_size (uint8_t channel)
 Get the file's size, in bytes. More...
 
void neo_file_set_size (uint8_t channel, uint32_t size)
 Set the file's size. More...
 
void neo_file_rename_p (const neo_pstring_t *from, const neo_pstring_t *to)
 Rename file, using Pascal strings for the filenames. More...
 
void neo_file_rename (const char *from, const char *to)
 Rename file, using C strings for the filenames. More...
 
void neo_file_delete_p (const neo_pstring_t *filename)
 Delete file, using Pascal strings for the filename. More...
 
void neo_file_delete (const char *filename)
 Delete file, using C strings for the filename. More...
 
void neo_file_chdir_p (const neo_pstring_t *path)
 Change current working directory, using a Pascal string for the path. More...
 
void neo_file_chdir (const char *path)
 Change current working directory, using a C string for the path. More...
 
void neo_file_mkdir_p (const neo_pstring_t *path)
 Create directory, using a Pascal string for the path. More...
 
void neo_file_mkdir (const char *path)
 Create directory, using a C string for the path. More...
 
void neo_file_stat_p (const neo_pstring_t *path, neo_file_stat_t *st)
 Retrieve file information, using a Pascal string for the path. More...
 
void neo_file_stat (const char *path, neo_file_stat_t *st)
 Retrieve file information, using a C string for the path. More...
 
void neo_file_opendir_p (const neo_pstring_t *path)
 Open a directory for enumeration, using a Pascal string for the path. More...
 
void neo_file_opendir (const char *path)
 Open a directory for enumeration, using a C string for the path. More...
 
void neo_file_readdir_p (neo_pstring_t *path, neo_file_stat_t *st)
 Read the next file item from the directory, returning a Pascal string for the path. More...
 
void neo_file_readdir (char *path, neo_file_stat_t *st)
 Read the next file item from the directory, returning a C string for the path. More...
 
void neo_file_closedir (void)
 Close the directory opened with. More...
 
void neo_file_copy_p (const neo_pstring_t *from, const neo_pstring_t *to)
 Copy file, using Pascal strings for the filenames. More...
 
void neo_file_copy (const char *from, const char *to)
 Copy file, using C strings for the filenames. More...
 
void neo_file_set_attr_p (const neo_pstring_t *path, uint8_t attr)
 Set file attributes, using a Pascal string for the filename. More...
 
void neo_file_set_attr (const char *path, uint8_t attr)
 Set file attributes, using a C string for the filename. More...
 
void neo_file_list_filtered_p (const neo_pstring_t *filter)
 Display a filtered listing of files in the current directory, using a Pascal string for the needle. More...
 
void neo_file_list_filtered (const char *filter)
 Display a filtered listing of files in the current directory, using a C string for the needle. More...
 

Macro Definition Documentation

◆ NEO_FILE_ATTR_ARCHIVE

#define NEO_FILE_ATTR_ARCHIVE   0x04

◆ NEO_FILE_ATTR_DIRECTORY

#define NEO_FILE_ATTR_DIRECTORY   0x01

◆ NEO_FILE_ATTR_HIDDEN

#define NEO_FILE_ATTR_HIDDEN   0x10

◆ NEO_FILE_ATTR_READ_ONLY

#define NEO_FILE_ATTR_READ_ONLY   0x08

◆ NEO_FILE_ATTR_SYSTEM

#define NEO_FILE_ATTR_SYSTEM   0x02

◆ NEO_FILE_DESTINATION_GRAPHICS

#define NEO_FILE_DESTINATION_GRAPHICS   ((void*) 0xFFFF)

Typedef Documentation

◆ neo_file_mode_t

◆ neo_file_stat_t

Enumeration Type Documentation

◆ neo_file_mode

Enumerator
NEO_FILE_READ 
NEO_FILE_WRITE 
NEO_FILE_READ_WRITE 
NEO_FILE_CREATE 

Function Documentation

◆ neo_file_chdir()

void neo_file_chdir ( const char *  path)

Change current working directory, using a C string for the path.

Parameters
pathPath (C string)

Check errors with

See also
neo_api_error

◆ neo_file_chdir_p()

void neo_file_chdir_p ( const neo_pstring_t path)

Change current working directory, using a Pascal string for the path.

Parameters
pathPath (Pascal string)

Check errors with

See also
neo_api_error

◆ neo_file_close()

void neo_file_close ( uint8_t  channel)

Close a file channel.

Parameters
channelChannel ID

Check errors with

See also
neo_api_error

◆ neo_file_closedir()

void neo_file_closedir ( void  )

Close the directory opened with.

See also
neo_file_opendir .

Check errors with

See also
neo_api_error

◆ neo_file_copy()

void neo_file_copy ( const char *  from,
const char *  to 
)

Copy file, using C strings for the filenames.

Parameters
fromOld filename (C string)
toNew filename (C string)

Check errors with

See also
neo_api_error

◆ neo_file_copy_p()

void neo_file_copy_p ( const neo_pstring_t from,
const neo_pstring_t to 
)

Copy file, using Pascal strings for the filenames.

Parameters
fromOld filename (Pascal string)
toNew filename (Pascal string)

Check errors with

See also
neo_api_error

◆ neo_file_delete()

void neo_file_delete ( const char *  filename)

Delete file, using C strings for the filename.

Note that deleting an open file is undefined behaviour. In addition, directories can only be deleted if empty.

Parameters
filenameFilename (C string)

Check errors with

See also
neo_api_error

◆ neo_file_delete_p()

void neo_file_delete_p ( const neo_pstring_t filename)

Delete file, using Pascal strings for the filename.

Note that deleting an open file is undefined behaviour. In addition, directories can only be deleted if empty.

Parameters
filenameFilename (Pascal string)

Check errors with

See also
neo_api_error

◆ neo_file_list_directory()

void neo_file_list_directory ( void  )

Display the listing of files in the current directory.

◆ neo_file_list_filtered()

void neo_file_list_filtered ( const char *  filter)

Display a filtered listing of files in the current directory, using a C string for the needle.

Parameters
filterFilename search needle (C string)

◆ neo_file_list_filtered_p()

void neo_file_list_filtered_p ( const neo_pstring_t filter)

Display a filtered listing of files in the current directory, using a Pascal string for the needle.

Parameters
filterFilename search needle (Pascal string)

◆ neo_file_load()

void neo_file_load ( const char *  filename,
void *  dest 
)

Load a file into memory, using a C string for the filename.

To load a file into graphics memory, use

See also
NEO_FILE_DESTINATION_GRAPHICS .
Parameters
filenameFilename (C string)
destDestination

Check errors with

See also
neo_api_error

◆ neo_file_load_p()

void neo_file_load_p ( const neo_pstring_t filename,
void *  dest 
)

Load a file into memory, using a Pascal string for the filename.

To load a file into graphics memory, use

See also
NEO_FILE_DESTINATION_GRAPHICS .
Parameters
filenameFilename (Pascal string)
destDestination

Check errors with

See also
neo_api_error

◆ neo_file_mkdir()

void neo_file_mkdir ( const char *  path)

Create directory, using a C string for the path.

Parameters
pathPath (C string)

Check errors with

See also
neo_api_error

◆ neo_file_mkdir_p()

void neo_file_mkdir_p ( const neo_pstring_t path)

Create directory, using a Pascal string for the path.

Parameters
pathPath (Pascal string)

Check errors with

See also
neo_api_error

◆ neo_file_open()

void neo_file_open ( uint8_t  channel,
const char *  filename,
uint8_t  mode 
)

Open a file channel, using a C string for the filename.

Parameters
channelChannel ID
filenameFilename (C string)
modeMode
See also
neo_file_mode_t

Check errors with

See also
neo_api_error

◆ neo_file_open_p()

void neo_file_open_p ( uint8_t  channel,
const neo_pstring_t filename,
uint8_t  mode 
)

Open a file channel, using a Pascal string for the filename.

Parameters
channelChannel ID
filenameFilename (Pascal string)
modeMode
See also
neo_file_mode_t

Check errors with

See also
neo_api_error

◆ neo_file_opendir()

void neo_file_opendir ( const char *  path)

Open a directory for enumeration, using a C string for the path.

Parameters
pathPath (C string)

Check errors with

See also
neo_api_error

◆ neo_file_opendir_p()

void neo_file_opendir_p ( const neo_pstring_t path)

Open a directory for enumeration, using a Pascal string for the path.

Parameters
pathPath (Pascal string)

Check errors with

See also
neo_api_error

◆ neo_file_read()

uint16_t neo_file_read ( uint8_t  channel,
void *  dest,
uint16_t  len 
)

Read bytes from an open file.

To read into graphics memory, use

See also
NEO_FILE_DESTINATION_GRAPHICS .
Parameters
channelChannel ID
destDestination
lenLength, in bytes
Returns
Amount of data actually read

Check errors with

See also
neo_api_error

◆ neo_file_readdir()

void neo_file_readdir ( char *  path,
neo_file_stat_t st 
)

Read the next file item from the directory, returning a C string for the path.

Parameters
filenameReturned filename (C string)
stStat information structure

Check errors with

See also
neo_api_error

◆ neo_file_readdir_p()

void neo_file_readdir_p ( neo_pstring_t path,
neo_file_stat_t st 
)

Read the next file item from the directory, returning a Pascal string for the path.

Parameters
filenameReturned filename (Pascal string)
stStat information structure

Check errors with

See also
neo_api_error

◆ neo_file_rename()

void neo_file_rename ( const char *  from,
const char *  to 
)

Rename file, using C strings for the filenames.

Parameters
fromOld filename (C string)
toNew filename (C string)

Check errors with

See also
neo_api_error

◆ neo_file_rename_p()

void neo_file_rename_p ( const neo_pstring_t from,
const neo_pstring_t to 
)

Rename file, using Pascal strings for the filenames.

Parameters
fromOld filename (Pascal string)
toNew filename (Pascal string)

Check errors with

See also
neo_api_error

◆ neo_file_seek()

void neo_file_seek ( uint8_t  channel,
uint32_t  pos 
)

Seek a file.

Parameters
channelChannel ID
posNew file position

Check errors with

See also
neo_api_error

◆ neo_file_set_attr()

void neo_file_set_attr ( const char *  path,
uint8_t  attr 
)

Set file attributes, using a C string for the filename.

Parameters
pathFilename (C string)
attrNew attributes

Check errors with

See also
neo_api_error

◆ neo_file_set_attr_p()

void neo_file_set_attr_p ( const neo_pstring_t path,
uint8_t  attr 
)

Set file attributes, using a Pascal string for the filename.

Parameters
pathFilename (Pascal string)
attrNew attributes

Check errors with

See also
neo_api_error

◆ neo_file_set_size()

void neo_file_set_size ( uint8_t  channel,
uint32_t  size 
)

Set the file's size.

Parameters
channelChannel ID
sizeNew file size, in bytes

Check errors with

See also
neo_api_error

◆ neo_file_size()

uint32_t neo_file_size ( uint8_t  channel)

Get the file's size, in bytes.

Parameters
channelChannel ID
Returns
File size, in bytes

Check errors with

See also
neo_api_error

◆ neo_file_stat()

void neo_file_stat ( const char *  path,
neo_file_stat_t st 
)

Retrieve file information, using a C string for the path.

Parameters
pathPath (C string)
stStat information structure

Check errors with

See also
neo_api_error

◆ neo_file_stat_p()

void neo_file_stat_p ( const neo_pstring_t path,
neo_file_stat_t st 
)

Retrieve file information, using a Pascal string for the path.

Parameters
pathPath (Pascal string)
stStat information structure

Check errors with

See also
neo_api_error

◆ neo_file_store()

void neo_file_store ( const char *  filename,
const void *  src,
uint16_t  len 
)

Store a file from memory, using a C string for the filename.

Parameters
filenameFilename (Pascal string)
srcSource
lenLength, in bytes

Check errors with

See also
neo_api_error

◆ neo_file_store_p()

void neo_file_store_p ( const neo_pstring_t filename,
const void *  src,
uint16_t  len 
)

Store a file from memory, using a Pascal string for the filename.

Parameters
filenameFilename (Pascal string)
srcSource
lenLength, in bytes

Check errors with

See also
neo_api_error

◆ neo_file_tell()

uint32_t neo_file_tell ( uint8_t  channel)

Tell a file's position.

Parameters
channelChannel ID
Returns
Current file position

Check errors with

See also
neo_api_error

◆ neo_file_write()

uint32_t neo_file_write ( uint8_t  channel,
const void *  src,
uint16_t  len 
)

Write bytes to an open file.

Parameters
channelChannel ID
srcSource
lenLength, in bytes
Returns
Amount of data actually written

Check errors with

See also
neo_api_error