home *** CD-ROM | disk | FTP | other *** search
-
-
- Date: 930626
-
- File: Xmodem Padding
-
-
- XMODEM Padding, How to deal with it!
- ====================================
-
- So, Bunky, you've plugged into the telecom world. You've downloaded a slew
- of really nifty programs and you're ready to roll! Well, I really hate to tell
- you this, but there could be a GOTCHA in your way. Who said life was fair?
-
- The GOTCHA!
- ----------
-
- The GOTCHA involves programs and XMODEM padding. They sometimes don't get
- along at all. The culprit here is the XMODEM protocol. Remember, XMODEM was
- developed for CP/M systems, and it works fine on MS-DOS systems too. Trouble
- is, XMODEM only deals in 128-byte or 1024-byte blocks. What happens when
- someone transmits a file that doesn't happen to be a multiple of 128/1024
- bytes? Simple... XMODEM sticks padding on the end of the last block. This is
- the (in)famous XMODEM padding we all know and love. The padding character is
- usually a NULL (a CHR$(0)) or control Z (a CHR$(26)), depending on the phase of
- the moon and the biorhythms of the programmer who wrote that particular
- implementation of XMODEM.
-
- Most programs you download simply ignore the extra data at the end. A very few
- (some machine language files and BASIC-64 and BASIC-128 compiled programs)
- depend on the end of the file being the LAST thing in memory. With the extra
- XMODEM bytes at the end, these programs will go off to never-never land when
- RUN.
-
- So how do we deal with padding? Several ways.
-
- 1) Download only ARC, SDA or SFX files. ARC and SDA save the original file
- length as part of the file description and the padding never gets applied to an
- individual file. However, this is the "chicken" way out and you'll end up
- missing some WONDERFUL programs!
-
- 2) Use a terminal program that automatically strips off Xmodem padding from a
- file. A few terminals will attempt to do this as the program downloads. If it
- is successful, you'll never even SEE padding on a file. This is a good choice,
- but it really limits you to your choices of terminal programs to use. Most of
- the better terms don't attempt to chop off padding on the fly. WIZARD will
- perform this stripping automatically.
-
- 3) Strip it off yourself, if you find you have to. It's really pretty easy
- and just takes a short while. After you've done it once or twice, it's no
- trouble at all.
-
- There are several methods of stripping off Xmodem padding. The simplest is to
- use a "padding stripper" program. There are a couple here in the Commodore
- software libraries that allow you to easily remove the padding (CNTRL-Z's) from
- any file you choose.
-
-
- Another option is to use program that "edits" a section of memory. One of the
- easiest is built right into Bob's Term Pro 64 and 128. Simply load the program
- into the buffer. Using the cursor controls, move to the very end of the file.
- If there is padding on the file it will usually be CHR$(26) or CHR$(0)
- characters. CAUTION: Don't confuse xmodem padding with the normal end of a
- BASIC program. All BASIC programs end with 3 CHR$(0) characters. Since 99% of
- the padding you will encounter will be CHR$(26) this won't be a problem (just
- something to keep in mind SHOULD it pop up!) Now, you're at the end and have
- located the padding. Simply delete those extra characters and save the file to
- disk. You should save it under a different filename from the original in case
- you make a mistake. That way you won't nuke your only copy!
-
- What happens if the file is too big to fit in your editor's buffer? If you are
- using Bob's Term, just fill the buffer with the file you are checking, then
- write it back to disk with a different filename. Then, load the 2nd half into
- the buffer with the FILL FROM BYTE command from the FILL menu. You'll want to
- begin at the byte you left off on (which is the number shown as the size of the
- buffer when empty...28500 for the 64 version if I remember correctly). Now
- when the 2nd half loads, you can scroll thru like usual, and delete the padding
- bytes at the end. Then DUMP to DISK with the same filename as the first buffer
- save. It will tell you the filename is duplicate, and ask if you want to
- Replace or Append. Just Append! Your file will be restored to it's original
- size, less the padding! (It's the same procedure that's used to split up great
- big SEQ files into something a little more manageable)!
-
- A final option is to use a "sector editor" and edit the file directly on the
- disk. While this is a perfectly valid option, it does require a little
- knowledge of disk data formats and a firm grasp of the hexadecimal numbering
- system. Once you have your favorite sector editor fired up, move to the end of
- the file you need to strip. On that last block the second byte in the file is
- the number of valid data bytes in this block. Just locate and count the number
- of padding bytes and subtract this from the number of bytes in the block (the
- 2nd data byte on this disk block). Change the byte and write the sector back
- to the disk. If you use this method, BE SURE OF WHAT YOU ARE DOING! Always
- work on a backup disk or you could easily destroy valid data in the sector you
- are working on or elsewhere on the disk.
-
-
- One redeeming factor. Virtually all the files that have problems with Xmodem
- padding will be ARCed or in SDA format here in the Commodore RoundTable. (One
- of the jobs of a SysOp is to watch out for these little buggers and head off
- problems BEFORE they get to you!) Since ARC knows the proper size and stores
- it as part of the ARChive,padding is NEVER a problem if you have downloaded an
- ARC or SDA/SFX file.
-
-
- ###############################
- Back To Survival Kit Menu!
- ###############################
-