Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!jason From: jason@ux1.cso.uiuc.edu (Jason) Newsgroups: comp.sys.mac.programmer Subject: Re: Device drivers : must they be written in assembler? Message-ID: <1990Sep12.171836.27850@ux1.cso.uiuc.edu> Date: 12 Sep 90 17:18:36 GMT References: <872.26ee1d0a@iccgcc.decnet.ab.com> Organization: University of Illinois at Urbana Lines: 23 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? Think C _does_ allow you to create device drivers/desk accessories, and rather painlessly. When you identify your project as being a driver/DA (from the "Project, Set Project Type..." dialog), Think adds "glue" code to the beginning of your driver to make it look and behave as the Macintosh expects it to. The main() function itself is passed the i/o parameter block pointer, the device control entry pointer, _and_ a message parameter (similar to those in defProcs, like CDEFs) which tells the driver which function to perform (i.e., Open, Prime, Control, Status, or Close). This message can be used as a selector in a switch-case block to cause execution to branch to the appropriate routine. -- | | |====================| | | | Jason Watts | \ |\ |\ \ | (jazzin@uiuc.edu) |