

Textfile convert utilities

Working with textfiles on different operating system
can be quite annoying when you transfer the files without conversion.
In the good old days of Kermit that was not a serious problem since that was
take care of by the Kermit implementation.

Something that easily will happen when you transfer by floppy from a
MSX system to a PC or use the Internet and receice a Unix like text file.

Since MSX-DOS is at least CP/M compatible you will find many programs
running on MSX that are really CP/M programs.
But MSX-DOS uses the same file system and text file standard as MS-DOS and
(except long filenames) MS Windows 9x/NT/2000.

And there are some significant differences between textfiles on disk
for MS(X)-DOS and CP/M.
The most important difference is that CP/M files are always a multitude
of 128 bytes. On MS(X)-DOS a file can have any length.

On MS(X)-DOS a textfile is a stream of bytes with:
end of line is a CRLF pair
end of file is just the last character in the file

On CP/M a textfile is a stream of bytes with:
end of line is a CRLF pair
end of file is the control character with hex value 1A
the rest of the remaining (to reach the 128) in the file is unimportant and often
filled with more 1A's.

On Unix a text file is a stream of bytes with:
end of line is a LF character
end of file is the last character in the file

Working in an editor with one type of file on another opereating system
is quite annoying and often fails.

So i wrote a collection of small programs for MS-DOS and MSX-DOS to convert
from one type to another. Mostly used with Turbo Pascal editors, because i like to
crosscompiling.

DOS2CPM converts a text file in MS-DOS format to CP/M format, 
also replaces TAB with a SPACE, since Turbo Pascal 3 hates TABs
CPM2DOS converts CP/M format to DOS format
DOS2UX  converts DOS format to Unix (strips all CR's)
UX2DOS  converts Unix format to DOS format (replaces LF with CRLF if necessary)

As you can see there is not a separate UX2CPM and CPM2UX utility, just use DOS as a
intermediate step.

All utilities work alike:

DOS2CPM <filename to convert>

Without argument a short description is given. 

The COM files are for MSX-DOS (1 and 2), the EXE files for MS-DOS 3.3
and higher (tested upto Windows 98).

If you want to use these utilities from the Windows Explorer, you can do so:
- Select the Windows/Send to folder
- create a shortcut to the program
Fron now on you can start the utility in the Explorer by rightclicking on the file to convert
and using the Send to menu. Even multiple files can be handled this way in one action.
Just ignore the DOS window that pops up and disappears and do not forget that these
programs do not work on long filenames.

Source is included, ofcourse in Turbo Pascal.
You need Turbo Pascal 3.3f on MSX-DOS, not Version 3.0x since it does not know about
MSX-DOS files. On MS-DOS i used Turbo Pascal 5.0, i think version 6 or 7 will work too. 
No modifications are required to compile on either operating systems.

Have fun, MSX forever,

Hans Otten september 2000



