aycock@cpsc.ucalgary.ca (John Aycock) (03/12/89)
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 :-) ??? Thanks in advance. Please mail responses to: //\|_||\| ...{alberta|ubc-cs|utai}!calgary!xenlink!john \/ \/| || | ...{alberta|ubc-cs|utai}!calgary!aycock or aycock@acs-sun-fse (local only)
jimm@amiga.UUCP (Jim Mackraz) (03/13/89)
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.
karl@sugar.hackercorp.com (Karl Lehenbauer) (03/13/89)
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 :-) ??? Jim M. posted a solution already. Be aware, though, that on the Amiga 500 and 2000, flashing the power LED will also enable and disable the audio filter. -- -- uunet!sugar!karl | "Everyone has a purpose in life. Perhaps yours is -- | watching television." -- David Letterman -- Usenet BBS (713) 438-5018