|
| 1 | +# FATSTAT.LUA |
| 2 | + |
| 3 | +This Lua script reads and reports on the sector usage |
| 4 | +on FAT 12/16 formatted floppy disk images. |
| 5 | +Additionally, it has an optional function to zero out free clusters. |
| 6 | +This script is used in continuous integration of Lua for Watcom |
| 7 | +to ensure IMA floppy disk images |
| 8 | +containing the same files |
| 9 | +copied in the same order |
| 10 | +with the same metadata |
| 11 | +always have the same checksum. |
| 12 | +This might be necessary because copy commands may use free sectors like a cache. |
| 13 | + |
| 14 | +## Documentation |
| 15 | + |
| 16 | +This script has been squashed to save on disk space. |
| 17 | +The documentation for the functions are below. |
| 18 | + |
| 19 | +### Functions |
| 20 | + |
| 21 | +| **Function** | **Description** | **Output** | |
| 22 | +|-----------------|---------------------------------------------------------------------------------------------------------------------|-------------------------------------------| |
| 23 | +| `R16`</br>`R32` | **R**ead **16**-bit (`R16`) or **32**-bit (`R32`) integers from a data string at a specified offset. | Parsed values (e.g., total sectors). | |
| 24 | +| `F12`</br>`F16` | Decodes the FAT table for **F**AT**12** (`F12`) or **F**AT**16** (`F16`). | Returns a table representing the FAT. | |
| 25 | +| `FD` | **D**etermines the **F**AT type based on the total cluster count. FAT12 if <4085 clusters, FAT16 if <65525. | FAT type and total cluster count. | |
| 26 | +| `CC` | Follows the FAT **c**luster **c**hain to identify which clusters are allocated to a file. | A list of clusters allocated to the file. | |
| 27 | +| `FR` | **F**ormats a list of clusters into a readable **r**ange string (e.g., `<2-4>`, `<5>`). | String representation of cluster ranges. | |
| 28 | +| `DE` | Reads **d**irectory **e**ntries (files) from the root directory and retrieves their cluster allocation information. | Outputs file names and cluster ranges. | |
| 29 | +| `FC` | Identifies **f**ree **c**lusters and optionally writes zeros to them if the `-z` flag is used. | Ranges of free clusters. | |
0 commit comments