Newsgroups: comp.sys.apple2.programmer Subject: Re: Reading Text from a file From: dempson@actrix.gen.nz (David Empson) Date: Mon, 2 Aug 1999 22:40:24 +1200 Message-ID: <1dvxl7i.udox16hqqhkwN@dempson.actrix.gen.nz> References: <7nnbsf$rn9$1@news.ccit.arizona.edu> <1dvq370.qnp79211ccr9kN@dempson.actrix.gen.nz> <37a34484.6367086@news> <1dvvdg4.1f33oie3sq9u0N@dempson.actrix.gen.nz> <37a47d37.66531396@news> Organization: Empsoft X-Newsreader: MacSOUP 2.3 NNTP-Posting-Host: 202.49.157.176 X-Original-NNTP-Posting-Host: 202.49.157.176 X-Trace: 2 Aug 1999 22:37:51 NZST, 202.49.157.176 Lines: 41 Path: news1.icaen!news.uiowa.edu!NewsNG.Chicago.Qual.Net!207.24.245.130!nyd.news.ans.net!bignews.mediaways.net!newsfeed.icl.net!ihug.co.nz!news.iprolink.co.nz!news.actrix.gen.nz!dempson Xref: news1.icaen comp.sys.apple2.programmer:10830 Jeff Blakeney wrote: > > Having never heard of the files he was reading, I felt that > assumptions shouldn't be made about the data which is why I posted > that follow up. For your information: Intel Hex files have lots of lines which look like this: :101000000123456789ABCDEF0123456789ABCDEFxx (Colon = line prefix, 10 = data byte count, 1000 = address, 00 = line type, 01234...EF01...EF = data, xx = checksum.) Motorola S-record file lines look more like this: S11310000123456789ABCDEF0123456789ABCDEFxx (S = line prefix, 1 = line type, 13 = byte count for rest of line, 1000 = address, 01234...EF01...EF = data, xx = checksum.) In both cases the 'xx' is an appropriate checksum as two hex digits. Intel uses twos complement, Motorola uses ones complement, if I remember right. They are both used for text-based memory images. As shown, each line contains an address, which may be a target address for the system or an offset into the EPROM, depending on what generated the file. The byte count for the line is arbitrary, but is usually limited to 20 hex (32 bytes) to avoid lines which wrap in 80 columns. There may be gaps in the data, and the addresses don't have to be in ascending order. Both file formats have extensions for dealing with address spaces larger than 16 bits. -- David Empson dempson@actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand