Skip to content

ricdizio/Mips-FileSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Overview

Simple in-memory “filesystem” and command interpreter written in MIPS. Files are stored as nodes in a doubly linked list on the heap. You can create, copy, rename, delete, list, display, encrypt, and decrypt files. Optionally, an init.txt can preload files at startup.

Supported Commands

• mk • Create a new file (≤ 20 chars). • Prompt for up to 100 bytes of content, stored in one or more 100‑byte chunks. • cp • Copy an existing file node and its content to a new file. • ren • Rename a file. Handles multi‑chunk files by traversing linked pieces. • rm • Delete a file (frees its chunks and list node). • ls • List all filenames in insertion order. No arguments allowed. • cat • Print a file’s entire content in order of chunks. • ci • Encrypt each byte of using a function at the address in $a1. • dc • Decrypt each byte (inverse of ci). • Invalid or unrecognized commands • Print “Comando invalido” or the appropriate Spanish error for wrong parameters, nonexistent files, or invalid names.

Initialization File (init.txt)

If present, dir_init reads: 1. Number of files (N, ≤ 65535). 2. For each file: • File name (≤ 20 chars) • Number of lines (L, ≤ 65535) • L content lines (≤ 100 bytes each)

Each chunk is stored in a 100‑byte buffer; multi‑line files split into multiple chunks. Errors in opening, reading, or exceeding limits print Spanish messages: • Error abriendo el archivo de inicializacion (-8) • Error leyendo el archivo de inicializacion (-9) • No puede haber mas de 65535 archivos … (-10) • No puede haber mas de 65535 lineas … (-11)

Data Structures • Master Node (12 bytes): • [0] = total file count • [4] = pointer to head (first file node) • [8] = pointer to tail (last file node) • File Node (44 bytes): • Bytes 0–19: filename (ASCII, zero‑ or newline‑terminated) • Word (20): chunk size (0–100) • Word (24): pointer to chunk content (heap buffer) • Word (28): encryption flag (0 or nonzero) • Word (32): prev pointer (or 0) • Word (36): next pointer (or 0) • Word (40): chunk index/metadata (0 = single‐chunk; ≥ 1 for multi‐chunk) • Buffers in .data: • comando (45 bytes) – raw command input • nombre1, nombre2 (21 bytes each) – parsed filenames • contenido (101 bytes) – input for mk content • fileBuffer, contentBuffer (100 bytes each) – used during init • procesBuffer (45 bytes) – for encryption loops • Error strings (e.g., error0–error11), welcome messages, etc.

Build & Run

1.	Open Micromouse.s in a MIPS simulator (MARS or SPIM).
2.	Assemble/compile.
3.	Run with console I/O enabled.
4.	(Optional) Place a properly formatted init.txt in the same directory to preload files.
5.	At the prompt:

BIENVENIDO AL INTERPRETE DE COMANDOS Aqui podra administrar su sistema de archivos

Ingrese comando:

Type any supported command (e.g., mk myfile, ls, cat myfile).

Error Codes & Messages

When a routine sets $v0 to a negative code, the error routine prints one of:

Code Condition Message (Spanish)  -1  Unrecognized syntax or invalid mnemonic  Comando invalido  -2  Wrong number of parameters  Cantidad erronea de parametros  -3  Parameter(s) not recognized in directory  El sistema no reconoce el/los parametro(s) especificado(s)  -4  Insufficient space in directory  Espacio insuficiente en el sistema de directorio  -5  Filename already used  El nombre de archivo ya ha sido usado, por favor ingrese un nombre diferente  -6  Specified file does not exist  El archivo especificado no existe  -7  One or more parameters longer than 20 chars  Alguno(s) de lo(s) parametro(s) de entrada posee(n) una longitud superior a la permitida de 20 caracteres  -8  Error opening init.txt  Error abriendo el archivo de inicializacion  -9  Error reading init.txt  Error leyendo el archivo de inicializacion  -10  More than 65,535 files in initialization  No puede haber mas de 65535 archivos para cargar en la inicializacion, este sistema no lo permite  -11  More than 65,535 lines in a file during initialization  No puede haber mas de 65535 lineas en un archivo para cargar en la inicializacion, este sistema no lo permite  12   Invalid character(s) in command line  Se han ingresado caracteres invalidos. Solo se aceptan caracteres alfabeticos y ‘.’

Limitations

•	Filenames ≤ 20 ASCII chars (plus null).
•	Each chunk ≤ 100 bytes; multi‑line files split into 100‑byte chunks.
•	Max 65,535 files and 65,535 lines per file in init.txt.
•	No persistence beyond runtime; all files exist only in memory.
•	Encryption/decryption requires a user‑supplied MIPS function.

© 2016 Universidad Simón Bolívar. Educational use only.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published