3 ms·
The space for the name is pre-booked, so in a sense all files always have a full 8-char name and 3-char extension, whether they like it or not. If you want to
by tom_ 8y ago
The space for the name is pre-booked, so in a sense all files always have a full 8-char name and 3-char extension, whether they like it or not.
If you want to support <8-char names, <3-char extensions, or no extension at all, you need to decide on values that indicate this, because those bytes will still need filling with something.
(On 6502-based systems, 0 would be a reasonable choice for a padding value, because you get a free zero check every time you read a byte. The 8086 doesn't work like this... I don't think any particular value suggests itself. Perhaps they thought picking a printable character would be useful.)
- red_admiral 8y agoPicking the space character, apart from being I think an established convention already (the CHAR(n) type in databases), definitely has the advantage you can just "blit" the filename onto the video buffer in text mode when doing a DIR command. You don't have to bother with checking its length or anything, just copy 11 bytes and insert a space (not dot in the original DIR listing format) after the 8th one. If the file doesn't actually have an extension, this just prints the right number of spaces so the other columnms are aligned. EDIT: see https://en.wikipedia.org/wiki/Dir_(command)#/media/File:SpartaDOS_X_prompt.png https://en.wikipedia.org/wiki/Dir_(command)#/media/File:Spar... for an example.