Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!cernvax!chx400!ethz!neptune!inf.ethz.ch!mneerach From: mneerach@inf.ethz.ch (Matthias Ulrich Neeracher) Newsgroups: comp.sys.mac.programmer Subject: Re: Device drivers : must they be written in assembler? Message-ID: <7756@neptune.inf.ethz.ch> Date: 13 Sep 90 14:06:46 GMT References: <872.26ee1d0a@iccgcc.decnet.ab.com> <10178@goofy.Apple.COM> Sender: news@neptune.inf.ethz.ch Reply-To: mneerach@inf.ethz.ch.inf.ethz.ch (Matthias Ulrich Neeracher) Organization: Departement Informatik, ETH, Zurich Lines: 38 In article <10178@goofy.Apple.COM> stevec@Apple.COM (Steve Christensen) writes: >In article <872.26ee1d0a@iccgcc.decnet.ab.com> milikich@iccgcc.decnet.ab.com ((Mike Milikich), Allen-Bradley Company) writes: [...] >>Inside Mac Vol. II-6 desribes all sorts of neat stuff about device drivers, but >>also makes some sort of statement about how they are normally written in >>assembler. Is this just a dated statement, or is it still accurate? It seems >>unlikely that it wouldn't be possible to write a serial driver, say, in >>Think C. Anyone/everyone want to set me straight? >No, you can write a driver in whatever language you want, since you ultimately >end up with assembly language anyway. As long as the header has the correct >info, it doesn't really matter how the rest of the driver is done. I wouldn't >want to make a comment on whether or not the bit about writing drivers in >assembly is dated, but I think the reason for doing it that way is that you >have much more control over the generated code if it's written is assembly >(vs a high-level language like C) for those cases where timing issues are >critical... I think that the reason to make this statement was also that at that time, it was *very* difficult to get the header right. Today, MPW manages this with its powerful resource compiler and linker and the Think languages have the driver case as a built-in possibility, but things were different when this statement was written. Even today, most development systems have difficulties with automatically generating unusual headers. As an example, the HP DeskJet driver sources that recently were posted needed a considerable effort to create the correct headers for the PDEF resources in LightSpeed C. When I ported them to MPW, I just wrote the headers in assembler. So I don't think control over the generated code is such a problem, except for resource headers and register saving conventions. Matthias ----- Matthias Neeracher mneerach@inf.ethz.ch "I wouldn't recommend sex, drugs or insanity for everyone, but they've always worked for me" -- Hunter S. Thompson