z80playground / cpm-fat

CP/M for the Z80 Playground that runs on the FAT disk format
GNU General Public License v3.0
20 stars 9 forks source link

Files padded with zeros #62

Open kevinboone opened 3 years ago

kevinboone commented 3 years ago

Steps to reproduce (on a Linux workstation):

  1. Create a text file whose size is not a multiple of 256 bytes
  2. Copy the text file from my Linux system to the Z80-PG flash drive
  3. Open the text file using Wordstar4
  4. Note that WS displays a heap of "^@" characters at the end of the file.

Workaround: stick a ctrl-z on the end of the file before uploading.

I think what's happening here is the CP/M doesn't really have a way to handle files that are not multiples of a record in length. Text files are conventionally padded with ctrl-z's if they don't fit exactly. Copying a file from a non-CP/M system is inherently problematic, and files that don't fit into a record will have to be padded with something. Zero is as good a choice as anything, but ctrl-z might work better in some circumstances.

I don't know if files created using Windows would show the same behaviour -- I have a feeling that some Windows text editors still put a ctrl-z on the end automatically, for CP/M compatibility ;)