I'm playing with the M4 and the command C_READDIR (asm), i can for now read the entire dir and display its entries, but there is 3 bytes at the start of the dir entry that i don't know what they mean... At the moment I differentiate the folder entries by the ">" char, but what are the rest of the bytes for?
They echo the command you send + the response size. You can just skip them or use them to validate the reply is proper.
another thing, the format of the dir entry is a little weird, how can i format this entry:
"file . bin 1k"
to only "file.bin"
Is there any rule to make it easy?
If you send C_READDIR command with an argument, this argument is the max filename length to be returned.
Ie. to display long filenames in mode 2 with
|ls, I use 80 - 4 (for the size). Then filename as displayed in that width.
Also using this option you can avoid the "space" padding
Just set max filename length to 12 if you don't need long filenames, with that option it should not use space padding.
Without an argument it uses 8.3 filenames, formatted similar to AMSDOS.