$compact debug pw(79) rom sbx350_mod: DO; /* WARNING: * In order to run this lab from the Human Interface, the user must * have the ability to create tasks with a prioiryt of 126. If you * are using dynamic logon terminals, the process involves creating * a user with a maximum priority of 126 or greater (numerically * less). If you are using a static logon terminal, you may have to * reconfigure your system. */ $INCLUDE(:RMX:inc/rmxplm.ext) DECLARE SBX350$INT$LEVEL LITERALLY '75H', JOB$ABORTED LITERALLY '4', CR LITERALLY '0DH', LF LITERALLY '0AH', READ$WRITE LITERALLY '3', FOREVER LITERALLY 'WHILE 1', SBX350$PORT$A LITERALLY '0A0H', SBX350$PORT$B LITERALLY '0A2H', SBX350$PORT$C LITERALLY '0A4H', SBX350$CONTROL$PORT LITERALLY '0A6H'; /* Set Port A for strobed input and Port B for Mode 0 output */ DECLARE SBX350$INIT$MODE LITERALLY '10111000B', ENABLE$PORT$A$INTERRUPT LITERALLY '00001001B'; DECLARE console$token TOKEN; DECLARE sbx$init$msg (*) BYTE DATA (CR,LF,'The interrupt task is now initialized',CR,LF), control$c$msg (*) BYTE DATA (CR,LF,'Gonna go bye bye now',CR,LF); cc$trap: PROCEDURE PUBLIC; DECLARE status WORD; /* Clear the interrupt. */ CALL rq$reset$interrupt (SBX350$INT$LEVEL, @status); /* Let the operator know that we are finished. */ CALL dq$write (console$token,@control$c$msg,SIZE(control$c$msg),@status); /* Return control back to the CLI. */ CALL dq$exit (JOB$ABORTED); END cc$trap; sbx350$int$handler: PROCEDURE INTERRUPT REENTRANT PUBLIC; DECLARE status WORD; /* Let the interrupt task do all of the work. The time for a * context switch should help in the debounce of the interrupt * switch. */ CALL rq$signal$interrupt (SBX350$INT$LEVEL, @status); END sbx350$int$handler; /* Main line code is required so the application loader gets an * initialization record. * * We will open a connection to the terminal and set a CONTROL-C * handler in place before installing the interrupt handler. * * If a CONTROL-C is entered from the keyboard, the CONTROL-C * handler, cc$trap, will reset the interrupt and then call dq$exit. */ DECLARE status WORD; /* Install the CONTROL-C handler. */ CALL dq$trap$cc (@cc$trap, @status); /* Create an open connection to the console. :CI: and :CO: will * automatically be cataloged in our job's object directory as * part of the loading process. */ console$token = dq$attach (@(4,':CO:'), @status); CALL dq$open (console$token, READ$WRITE, 0, @status); /* Initilize the iSBX350 interface: * Port A = Input * Port B = Output * Port C = Output * Port A interrupt enabled */ OUTPUT (SBX350$CONTROL$PORT) = SBX350$INIT$MODE; OUTPUT (SBX350$CONTROL$PORT) = ENABLE$PORT$A$INTERRUPT; /* Install the interrupt handler. */ CALL rq$set$interrupt (SBX350$INT$LEVEL, 1, @sbx350$int$handler, SELECTOR$OF(NIL), @status); /* Inform the operator. */ CALL dq$write (console$token, @sbx$init$msg, SIZE(sbx$init$msg), @status); /* Loop forever, waiting for interrupts. */ DO FOREVER; CALL rq$wait$interrupt (SBX350$INT$LEVEL, @status); /* Wait to debounce the interrupt switch. */ CALL rq$sleep (1, @status); /* Get the input data. */ OUTPUT (SBX350$PORT$B) = NOT (INPUT (SBX350$PORT$A)); END; /* DO FOREVER */ END sbx350_mod;