/* LED                                                               
 * Toggle the state of the audio filter (CIAF_LED)
 *
 * Returns 0 if filter OFF (LED fully ON) 
 *   "     1 if filter ON  (LED dimmed, or OFF, depending on Amiga model ;-)
 *  
 * Shell ONLY!!
 */

#define __USE_SYSBASE 1

static const unsigned char version[] = "$VER: LED 0.2 "__AMIGADATE__" ©Gérard Cornu ;-)";

#include <exec/types.h>
#include <hardware/cia.h>

/* Address of CIAA chip: 
 */
#define CIAA 0xBFE001

/* Pointer to the CIA (8520) chip: 
 */
struct CIA *cia = (struct CIA *) CIAA;

long __saveds led(void) {
   return((cia->ciapra ^= CIAF_LED) & CIAF_LED ? 1: 0);
}
