Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!apple!oliveb!amiga!jimm From: jimm@amiga.UUCP (Jim Mackraz) Newsgroups: comp.sys.amiga Subject: Re: How can I flash the power light? Keywords: flash probably trivial Message-ID: <3611@amiga.UUCP> Date: 12 Mar 89 22:44:51 GMT References: <880@cs-spool.calgary.UUCP> Reply-To: jimm@cloyd.UUCP (Jim Mackraz) Organization: Commodore-Amiga Inc, Los Gatos CA Lines: 36 In article <880@cs-spool.calgary.UUCP> aycock@cpsc.ucalgary.ca (John Aycock) writes: )Sorry if this is a simple-minded question, but how can I get one of my )C or assembly programs to flash the power light (for any wise guys, this )means _without_ crashing the system :-) ??? Thought I'd post the response, since it's so useful. I've used these macros a couple of times for diagnostics when I couldn't even get kprintf() to work. I don't recommend using them for anything else ... #define TOGGLE_LED (*((char *) 0xbfe001) ^= 2 ) #define FLASH_LED( T ) {long int i; TOGGLE_LED; for(i=(T);--i;); TOGGLE_LED;\ for(i=(T); --i;);} /* I also condensed some frequent intervals ... */ #define LONGTIME 64000 #define SHORTTIME 32000 #define LONG_FLASH FLASH_LED( LONGTIME ) #define SHORT_FLASH FLASH_LED( SHORTTIME ) I might have to upgrade these macros for the '020 ;^) I go on to define the full set of Morse Code ... ;^) Note that an optimizing compiler will just toss away the delay loops, but if you can't get kprintf() to work you have no business using the optimizer yet. Also, Lattice V5.0 optimizer couldn't even handle these macros (caused CXERR in lc2), and I haven't used them (or the optimizer) since then. jimm -- Jim Mackraz, I and I Computing "Like you said when we crawled down {cbmvax,well,oliveb}!amiga!jimm from the trees: We're in transition." - Gang of Four Opinions are my own. Comments are not to be taken as Commodore official policy.