XFS Filesystem
Files stored in the local XFS filesystem can be viewed and managed live in your web browser using the Spectranext File Browser. Simply connect your device via USB and select it from the device picker to browse, upload, download, commit to flash, and manage files directly from your browser.
See Syncing with Computer for more details.
XFS is Spectranext's local filesystem that provides access to onboard storage directly from Spectrum programs. It combines a 4MB temporary RAM filesystem with a 4MB overlayed flash filesystem. Files uploaded from your computer go to RAM first for fast iteration; files committed to flash remain available after power loss.
In Spectranext BASIC, %mount "<url>" is a simplified form that mounts into a free slot and switches %fs to it automatically. This shorthand is specific to SpectraNext and is not available on the original Spectranet.
If you need BASIC compatibility with Spectranet, or you want to force a particular slot such as %mount 0, "xfs://ram/", use the full form with an explicit mount number.
Overview
XFS provides:
- Local Filesystem Access: Access files stored in Spectranext's RAM and committed flash layers
- Standard VFS Interface: Uses Spectranet's standard VFS (Virtual File System) API with
xfs://prefix - File Operations: Read, write, list, create, delete files and directories with standard Spectranet BASIC commands
- Development Workflow: Transfer files over USB, access them from Spectrum programs, and commit selected files to flash when they should persist
The filesystem is overlayed: flash-backed files and RAM-backed files appear in the same directory tree. There is no separate flash mount and no special permanent-storage folder. Reads prefer flash when a file exists in both layers. New files are written to RAM by default; writes to paths that already exist in flash update the flash-backed file. Use Commit To Flash in the Browser or spx commit <path> from the SDK when you want a RAM file to become permanent. Deletes remove the path from both layers.
See Overlayed Filesystem for the detailed layer rules and commit workflow.
Mounting XFS
To use XFS, you must first mount it. XFS uses the protocol name "xfs" and a hostname to specify which filesystem to mount.
Before mounting into a slot, it is best practice to unmount that slot first with %umount <slot> or umount(slot).
Mounting Local XFS
The local XFS filesystem is mounted using the protocol "xfs://ram/". The hostname remains "ram" for compatibility, even though committed flash files are visible through the same mount:
- BASIC
- C
- Assembly
%mount "xfs://ram/"
#include <spdos.h>
mount(0, NULL, NULL, "", "ram", "xfs");
.include "spectranet.inc"
; Mount structure
mount_struct:
defw protocol_str
defw hostname_str
defw path_str
defw user_str
defw password_str
protocol_str: defb "xfs",0
hostname_str: defb "ram",0
path_str: defb 0
user_str: defb 0
password_str: defb 0
; Mount at mount point 0
ld ix, mount_struct
ld a, 0
call MOUNT
Keep in mind, that mounting can be happen automatically upon boot.
Unmounting
- BASIC
- C
- Assembly
%umount 0
umount(0);
ld a, 0
call UMOUNT
Mount Points
Spectranet supports up to 4 mount points (0-3). Each mount point can have a different filesystem mounted:
- Mount Point 0: Default local XFS filesystem (
xfs://ram/) on Spectranext - Mount Point 1: Often used when loading Spectranext programs from HTTPS
- Mount Point 2: Spare additional mount when needed
- Mount Point 3: Preferred for business and application-level mounts (HTTP(s), TNFS, external resources)
See Filesystem overview: mount points for details.
You can switch between filesystems using:
- BASIC
- C
%fs 0 ; Switch to filesystem 0
setmountpoint(0); // Switch to filesystem 0
Accessing Files from Spectrum
Once XFS is mounted, you can access files using standard Spectranet VFS operations.