Communication Between BASIC and Assembly Language 129 If the number of item pseudo-instructions in the assembly language routine exceeds the number of items in common at the time the routine is called, an error results (number 199). A COM pseudo-instruction sequence need only be set up once per module. Each routine within the module has access to the information within the sequence. The three-word descriptors are filled, and type-checking occurs, only once - at the first ICALL of a routine within the module. Busy Bits Overlapped processing in the 9835A/ B is partially implemented through the facility of "busy bits" .
Each variable located in the BASIC value or common areas has associated with it two bits which are independent of the value - a "read" busy bit, and a "write" busy bit. Each time an I/O operation is executed that cannot be buffered, one of the busy bits is set. If a variable is having its value changed by the I/O operation, then the read busy bit is set. If the variable is output- ting its value in the I/O operation, then its write busy bit is set. If a variable is not involved in a pending I/O operation both bits are cleared. When the I/O operation is completed, the busy bits for the variables involved are cleared.
When an I/O operation is encountered during execution of BASIC statements, the appropriate busy bits are set and a request is made by the operating system for the resources to satisfy the operation. Until that operation is complete, BASIC (in OVERLAP mode), continues to execute succeeding lines in the program until it encounters a statement which contains variables with busy bits that are set. If the statement is attempting to use the value of a variable and its read busy bit is set, then the further execution of the statement waits until the busy bit is cleared. The same is true for a statement attempting to change the value of a variable when either its read or write busy bit is set.
When the I/O operation completes, the busy bits are cleared and the waiting statement is executed. In short, overlapped processing uses busy bits as a signal as to whether a statement can be executed or not.