Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!lll-winken!uwm.edu!cs.utexas.edu!usc!apple!rutgers!ncs.dnd.ca!asterix.drev.dnd.ca!louis From: louis@asterix.drev.dnd.ca (Louis Demers) Newsgroups: comp.sys.mac.programmer Subject: Surviving a Bus Error Keywords: nubus,io,bus error, exception,interrupt Message-ID: <1990Mar13.192544.1617@asterix.drev.dnd.ca> Date: 13 Mar 90 19:25:44 GMT Organization: DREV, Defence Research Est. Valcartier Lines: 38 Hi, Background: We are developing a piece of lab equipment which is controlled by a Macintosh II. We developed our own controllers which will be interfaced to the mac using GreenSpring IO card and some custom Industry Pack. The control registers can be configured at different addresses. Problems: When we access one of the registers and the controllers is not turned on, we crash with a bus errors. We suffer the same faith when we access the registers at the wrong address. Wish: I wish I could try to access an address and if the controller were turned off or not at this particular address, I would like to tell the user to check the power to the card or the address configuration. This could take the form of a subroutine with could be declared like this: int TryIT(Ptr memoryAddress,long *value) the return value could indicate if the access was successful and the parameter value could returned the actual value read. Question: Anybody has suggestions or better yet, code to do this ? Can it be done only in C ? I work with MPW 3.0 C and C++. ( I hate assembler but I feel like this time I won't be able to avoid it &-) Thanks in advance, Louis -- | Louis Demers | DREV, Defence Research Establishment,Valcartier | | louis@asterix.drev.dnd.ca | POBox 8800, Courcelette,Quebec, CANADA, G0A 1R0 | | (131.132.48.2) | Office: (418) 844-4424 fax (418) 844-4511 | +---------------------------+-------------------------------------------------+