Convert OS X or Unix filename to MS-DOS 8.3 filename?

I am working on an application that uses the DOSBox emulator software in order to run old DOS programs (such as WordPerfect) under OS X. I am trying to figure out a way to drop a file on my application and open it in WordPerfect under DOSBox. In order to do this for some files, I need to convert the OS X or Unix filename into the old MS-DOS 8.3 (filename.ext) format so that WordPerfect can open the file by reading the MS-DOS 8.3 name. (DOSBox automatically converts OS X/Unix filenames into 8.3 format when reading a directory, but it does not give the user a way to determine in advance the 8.3 name when you know the long filename.)

Under Windows, there are many ways to do this, but I can’t figure out a way to do this under OS X. I haven’t found a unix routine or an Applescript routine that can do it.

The specification for the conversion from a long name to an 8.3 short name is here:

http://support.microsoft.com/kb/142982

I think I have enough skill to write an Applescript routine that can perform the conversion, but if anyone has done this job already, I would be very glad to know about it.

Thanks for any help.