***********************************************************************
*
* teach.aii -- Version 3.0  (Main Program)
*
* Copyright (c)
* Apple Computer, Inc.  1986-1990
* All Rights Reserved.
*
* Developer Technical Support Apple II Sample Code
*
* This file contains the teach program.
*
***********************************************************************

	case  on
	longi on
	longa on

	INCLUDE 'e16.types'
	INCLUDE 'm16.gsos'
	INCLUDE 'm16.locator'
	INCLUDE 'm16.memory'
	INCLUDE 'm16.quickdraw'
	INCLUDE 'm16.util2'
	INCLUDE 'teach.equ'

***********************************************************************

	EXPORT main
main	PROC
	import userID, setupMenus, setupWindows, initGlobals
	import mainEvent

	phb	;Save caller's data bank pointer.
	phd	;Save caller's direct page pointer.
	phk	;Switch data bank into program bank.
	plb

	_TLStartUp	;Start up Tool Locator & Memory Mgr.
	pha	;Find out who we are.
	_MMStartUp
	pla
	sta userID

	jsr initGlobals	;Initialize our globals.

	pha	;Start up the tools	using
	pha	;resources.
	PushWord userID
	pea refIsResource
	pea 1>>16	;Resource ID.
	pea 1
	_StartupTools
	PullLong initRef	;Handle used by ShutdownTools.
	bcs startFailed

	jsr setupMenus
	jsr setupWindows
	_InitCursor
	jsr mainEvent

startFailed	pea refIsHandle	;Now shut them all down.
	PushLong initRef
	_ShutdownTools

	pushword userID
	_MMShutDown
	_TLShutDown

	_QuitGS quitParms	;Leave here.

initRef	DC.L 0
quitParms	DC.W 0
	DC.L 0
	DC.W 0

	ENDP

	END
