hewlett-packard HP 9835A — 150

150 I/O Handling BASIC Branching on Interrupts The handling of interrupts can be integrated into BASIC programs by using the ON INT statements. The object is to allow the flexibility of combining the high-level features of BASIC cannot use the system utilities, in particular those that access a BASIC variable, a means of with the capabilities of assembly language in asynchronous I/O applications. And since ISRs taking action on an interrupt after completion of the ISR is a necessity. ON INT Statement The ON INT statement is an executable BASIC statement which acts in a similar fashion to the ON KEY statement (see the 9835A/B Operating and Programming Manual).

The statement allows the BASIC programmer to specify where, in his BASIC program, to branch whenever an interrupt is signalled for the select code he specifies. As with the ON KEY statement, there are three ways these branches can be taken - ::!:!: {select code} [:, {priority} ] C······ ! ... {subprogram name} :!:!:: {select code} [:, {priority}] (:; ':::::; L..! IJ {line identifier} +1:: {select code} L {priority}] ': .. ::

T() {line identifier} Whenever an interrupt is signalled from an ISR for a particular select code, if ON INT has been executed for that select code, then at the end of execution of the BASIC line which was executing when the signal came, the indicated branch in the ON INT is taken. line indicated and picks up its execution there, forgetting where it was before.

This has the In the GOTO version, the branch is "absolute", which is to say that the program goes to the effect of an "abortive" type of branch, and should only be used by the BASIC programmer when he wants the program to resume execution at some pre-determined point after handling an interrupt, without regard to where the program was before the interrupt occurred. In the CALL and GOSUB versions, the branch is only temporary. After the subprogram or subroutine has been executed and the SUBEXIT, SUBEND, or RETURN (as appropriate) has been executed, then the program returns to the line following the one where it was interrupted.

This is the same as if the CALL or GOSUB was in between the interrupted line and the one following it. The {line identifier} and {subprogram name} in the CALL, GOSUB, and GOTO statements are the same as elsewhere in BASIC, except that a CALL may not have any parameters.