Miscellaneous ------------------------------------------------------------------ 1-801 Function Name: InitForIO Purpose: Open serial communication. Call address: $C25C Errors: See Appendix I. Description: This routine sets up the I/O ports for high speed serial communication with the disk drives. This routine is called prior to calling ReadBlock, WriteBlock or VerWriteBlock. 1-802 Function Name: DoneWithIO Purpose: Close off serial communication. Call address: $C25F Errors: See appendix I. Description: This routine resets the I/O ports after serial communication is complete. This routine is called after calls to ReadBlock, WriteBlock or VerWriteBlock. 1-803 Function Name: FirstInit Purpose: Part of GEOS's bootup process. Call address: $C271 Description: Initializes the VIC chip and the I/O chips. Some global memory is also initialized. It also resets the preferences and all the drives. The default drive is reset by a call to EnterTurbo. 1-804 Function Name: MainLoop Purpose: Enters GEOS's main loop. Call address: $C1C3 Input requirements: $849B-$849C appMain: Address of user's addition to GEOS's main loop (optional). Description: This loop does whatever polling is needed. First the button is checked, as well as the keyboard and the mouse's position. The command table at $8719 (See InitProcesses) is scanned for executable routines. Then the counters at $877F (See Sleep) are checked; those that have reached zero have their associated routines executed. The memory image of the clock is updated. Then the alarm clock is checked. Finally, the user's addition to the main loop, if there is one, is executed. This loop continues forever. 1-805 Function Name: InterruptMain Purpose: Handles several items that occur at regular timed intervals. Call address: $C100 Outputs: See description Description: GEOS sets up the raster interrupt on the VIC chip to cause an interrupt every sixtieth of a second. This routine is called by GEOS after each interrupt. First it reads the input device and updates the mouse's position, turning it on if necessary. It then scans the command table at $8719 to see if any of the command bytes have both bits 4 and 5 reset. If so, it then decrements the associated counter at $86F1. If the counter reaches zero, its value is reset and bit 7 of the associated command byte is set. This will cause the appropriate subroutine to be executed the next time the table is polled. The next part of this routine is to decrement all nonzero counters in the stack at $877F. The routine to blink the text cursor is called next. Finally, the random number generator at $850A is updated. 1-806 Function Name: BootGEOS Purpose: Reboot GEOS. Call address: $C000 Errors: If load fails, system resets to BASIC. Description: This routine is not part of the normal GEOS KERNAL jump table. This is the routine that is set up as the NMI interrupt (RESTORE key) by GEOS when GEOS returns to BASIC. It loads 'GEOS BOOT', and executes it. 1-807 Function Name: StartAppl Purpose: Execute a program already in memory. Call address: $C22F Input requirements: $02 R0L Flag byte. $06-$07 R2 Data pointer (optional). $08-$09 R3 Data pointer (optional). $10-$11 R7 Start address. Output: $06-$07 R2 Pointer to drive name 2. $08-$09 R3 Pointer to drive name 3. Description: This routine performs some initializations before executing a loaded program. If either bit 6 or bit 7 of the flag byte at location $02 is set, then the data pointed to by $06-$07 and $08-$09 are copied into the buffers for the 3rd and 4th drive names. These data blocks are limited to 16 bytes each. The initialization process selects the BSW font and initializes all of GEOS's global variables. 1-808 Function Name: EnterDesktop Purpose: Restart DESKTOP. Call address: $C22C Description: This routine loads DESKTOP and runs it. It is called as the last part of the bootup procedure. This is where a program should terminate. 1-809 Function Name: ToBasic Purpose: Restart BASIC with optional program load. Call address: $C241 Input requirements: $02-$03 R0 Pointer to 40 characters of text. $0C-$0D R5 Pointer to file's directory entry. $10-$11 R7 Load address. Preparatory routines: FindFile Description: The 40 characters pointed to by $02-$03 are saved in a buffer. If $0C-$0D is non-zero, the file is loaded into memory at the address specified by $10-$11. BASIC is restarted with an interrupt vector. This interrupt is set up to give BASIC a chance to start up. After the time has elapsed, the 40 characters in the buffer are copied to the screen and a CR is placed in the keyboard buffer. The interrupt vector is then removed, but the NMI vector is set up to reboot GEOS. The reboot code is at $C000- $C037. 1-810 Function Name: CallRoutine Purpose: Conditional jump. Call address: $C1D8 Input requirements: A The low (least significant) byte of the jump vector. X The high (most significant) byte of the jump vector. Description: If A and X are zero, the jump is not performed. If A and X are nonzero, the jump is performed. 1-811 Function Name: DoInlineReturn Purpose: Jump through a table. Call address: $C2A4 Input requirements: A Offset into table. $3D-$3E Table address. Description: This routine is called by all of the routines that have inline data. They all set $3D-$3E to the return address of the caller, index off of this pointer to get their data, then call the appropriate routine. When the routine finishes, A is loaded with the data table's length and this routine is called to return control to the caller after the data table. 1-812 Function Name: StartMouseMode Purpose: Initializes the mouse. Call address: $C14E Input requirements: C flag Clear if the mouse position should not be set. C flag Set if the mouse position should be set. Y The row position for the mouse (optional). $18-$19 R11 The column position for the mouse (optional). Description: This routine turns on the mouse and positions it if desired. If the column is set to 0, the mouse is not positioned even is the C flag is set. It also sets up the button pressed vector $84A1-$84A2 (mouseVector) and the close menu vector $84A7- $84A8 (mouseFaultVec). It also clears the flag at $84B6. This routine does not actually turn on the mouse. It calls MouseUp to reset bit 7 of location $30 (mouseOn); this will cause GEOS's interrupt routines to turn on the mouse. 1-813 Function Name: MouseUp Purpose: Turns on the mouse. Call address: $C18A Description: This routine sets bit 7 of location $30. The interrupt routines will turn on the mouse when it tries to update its position. 1-814 Function Name: MouseOff Purpose: Turns off the mouse. Call address: $C18D Description: This routine resets bit 7 of location $30, and actually turns off the mouse sprite. 1-815 Function Name: ClearMouseMode Purpose: Reset the mouse. Call address: $C19C Description: The flag at location $30 is set to $00, and the mouse sprite is turned off. However, since bit 7 of location $30 is not set, the next interrupt will turn it back on. 1-816 Function Name: Sleep Purpose: Sets up a time delay. Call address: $C199 Input requirements: $02-$03 R0 Amount of time delay value in 60ths of a second. Description: The counter is saved on a stack, as well as the return address of the caller. Control is passed back a level higher than the caller. When the timer runs out, control will return where it left off. This allows programs to incorporate delays without halting GEOS's many independent processes. This and InitProcesses appear to be the beginnings of multitasking for GEOS. 1-817 Function Name: GetRandom Purpose: Modifies the random number generator at $850A-$850B. Call address: $C187 Output: $850A-$850B random: New seed value. Description: This routine changes the 16 bit random number at $850A-$850B (random), using a simple yet elaborate formula. 1-818 Function Name: GetSerialNumber Purpose: Who knows? Call address: $C196 Output: $02-$03 R0 Value from $9F27-$9F28 ($3E66). Description: This routine seems to have absolutely no purpose. It copies a vector from $9F27-$9F28 ($3E66) to $02-$03. Locations $9F27 and $9F28 are checked by another routine at bootup. If it is zero then the first VLIR chain of the kernal ($9000-$9FFF) is rewritten to the disk. This may be a remnant of the GEOS development environment or it may be some kind of kernal version number. The code looks like this: LDA $9F28 STA $03 LDA $9F27 STA $02 RTS