;
; This file and its contents are supplied under the terms of the
; Mozilla Public License (MPL) version 2.0.  You may only use this
; file in accordance with the terms of version 2.0 of the MPL.
;
; A full copy of the text of the MPL should have accompanied this
; source.  A copy of the MPL is also available via the Internet at
; https://www.mozilla.org/en-CA/MPL/2.0.
;
; This Source Code Form is "Incompatible With Secondary Licenses",
; as defined by the Mozilla Public License, v. 2.0.
;
; This file implements the exit subroutine for the Flight Board.
;
; (C) Copyright Rich Teer 1990, 2023, 2026.
;

	globl	_exit				; Externally define exit function
	globl	_motor_off
	globl	_heater_off

_exit:
	OR.W	#$0700,SR			; Disable all interrupts
	MOVE.W	$A0,$800020			; Disable the PI/T timer
	JSR		_motor_off			; Turn off the motor
	JSR		_heater_off			; and turn off the heater
	TRAP	#11					; Call Monitor trap call renter,
	DATA	0,0					; to quit & return to Monitor
