Suppose an Assembly program needs to read an arbitrary binary file sequentially and process every byte.search for ^Z in the buffer, but what about binary files?
If BDOS function 20 Read Sequential reports an end of file condition by returning error code 01 in register A, how can the program tell what's the last byte of the file in a buffer that's likely filled only in part? With text files the program could
Similarly, if the program was written in Turbo Pascal and read the input with BlockRead from an untyped file, how would it detect the last byte?
On CP/M 2.2 there is no way to know. Since all files are written in 128-byte record chunks anyway, it's sort of moot. CP/M 3 introduced a way to set a byte count for the last record in a file, see notes in BDOS functions 15 and 30.
On CP/M 2.2 there is no way to know. Since all files are written in
128-byte record chunks anyway, it's sort of moot. CP/M 3 introduced a
way to set a byte count for the last record in a file, see notes in BDOS >functions 15 and 30.
I wonder about programs that have no knowledge of the file structure, such as file dump utilities and binary editors.
I wonder about programs that have no knowledge of the file structure, such as file dump utilities and binary editors.
dump bye.com
On Wednesday, December 7, 2022 at 2:32:52 PM UTC+1, Douglas Miller wrote:
On CP/M 2.2 there is no way to know. Since all files are written in 128-byte record chunks anyway, it's sort of moot. CP/M 3 introduced a way to set a byte count for the last record in a file, see notes in BDOS functions 15 and 30.
Thanks. I'm curious how such a situation was handled on CP/M 2.2, if at all. Did programs typically process all the bytes of the last buffer in full, even if it might contain trailing garbage?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (0 / 16) |
Uptime: | 118:56:00 |
Calls: | 6,704 |
Calls today: | 4 |
Files: | 12,235 |
Messages: | 5,349,464 |