Jinx wrote: > I've got a PIC which downloads 512kB from SRAM into the PC. At > present it's being written as an ASCII file, around 3MB, which is OK > for the time being but it has to be reduced to fit onto a floppy or as > a "reasonably" sized e-mail. Well, the simple and quick way to get over your problem is to just take the data as you presently have it, and compress the whole file for transport using LHARC or PKZIP, then expand it again when you need it. The compressed file will be easily under 1.4M. Perhaps more seriously, you want to write the file in either pure binary or HEX in the first place. Which of these you do depends mostly on how you plan to use the data later. If you write 512k in binary, you have a 512k file exactly, but need to use a specialised program to later interpret it. If you write it in HEX, you will have a 1.1M file which you can examine with a text editor. I happen to have the "Microsoft GW-BASIC User's Guide and User's Reference" here! It becomes quite obvious that BASIC makes it *extremely* difficult to use binary reads and writes, in part because it generally removes/ ignores zero bytes (NULs). I've been there before! Printing in HEX however is quite easy. First decide how many HEX numbers you want on a line. Convention is 32, assuming no spaces between (64 characters). You can also put the data address at the start of each line. Set up address variables ADHI, ADLO and AD$ and your data variable (DT). For each line, Print the address: AD$=RIGHT$(HEX$(ADHI/256+256),2)+RIGHT$(HEX$(ADHI+256),2) AD$AD$+=RIGHT$(HEX$(ADLO/256+256),2)+RIGHT$(HEX$(ADLO+256),2) PRINT#1,AD$+" "; In a loop of 32 repetitions, determine each DT and print it using PRINT#1,RIGHT$(HEX$(DT+256),2); Then at the end, complete the line using: PRINT#1, Now advance your address by 32 using suitable rollover functions which I will leave to you! If you want it prettified more, there are ways... Don't forget the semicolons where I have placed them at the end of the PRINT statements, and not where I haven't! -- Cheers, Paul B.