REM >testboot
REM $NetBSD: TestBoot,v 1.1.1.1 2002/05/09 20:03:57 jdolecek Exp $
REM
REM Copyright (c) 1995 Mark Brinicombe
REM All rights reserved
REM
REM Redistribution and use in source and binary forms, with or without
REM modification, are permitted provided that the following conditions
REM are met:
REM 1. Redistributions of source code must retain the above copyright
REM    notice, this list of conditions and the following disclaimer.
REM 2. Redistributions in binary form must reproduce the above copyright
REM    notice, this list of conditions and the following disclaimer in the
REM    documentation and/or other materials provided with the distribution.
REM 3. All advertising materials mentioning features or use of this software
REM    must display the following acknowledgement:
REM        This product includes software developed by Mark Brinicombe.
REM 4. The name of the company nor the name of the author may be used to
REM    endorse or promote products derived from this software without specific
REM    prior written permission.
REM
REM THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
REM IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
REM OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
REM IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
REM INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
REM BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
REM OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
REM ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
REM OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
REM THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
REM DAMAGE.
REM
REM NetBSD kernel project
REM
REM testboot
REM
REM Sets the FastBoot flag as required
REM
REM Created      : 12/05/95
REM Last updated : 03/09/95
REM

*Set NetBSD$FastBoot 0

REM Test for either ALT keys

IF (INKEY(-3) <> 0) THEN
  alt% = TRUE
  *Set NetBSD$FastBoot 1
ELSE
  alt% = FALSE
ENDIF

REM Get byte 80 from the CMOS RAM. This is a RiscIX byte that we are using.
REM bits are as follows :
REM bit 0 - configure bootNetBSD
REM bit 1 - automatic reboot required.

SYS "OS_Byte", 161, 80 TO ,,value%

REM Has the user configured a NetBSD boot ?
REM If a NetBSD boot has been configured ALT can be used to
REM select a RISC OS boot

IF (value% AND &01) THEN
  *Set NetBSD$FastBoot 2
ENDIF

REM Did the kernel request a automatic reboot ?

IF (value% AND &02) THEN
  *Set NetBSD$FastBoot 3
 
  REM Clear the automatic reboot flag
 
  SYS "OS_Byte", 162, 80, value% AND &fd
ENDIF

REM If the CMOS bits dictate a reboot then allow ALT to override.
IF (value% AND &03) THEN
  IF (alt% = TRUE) THEN
    *Set NetBSD$FastBoot 0
  ENDIF
ENDIF


REM Test for CTRL key - This does a fastconf and will override a reboot

IF (INKEY(-2) <> 0) THEN
  *Set NetBSD$FastBoot 4
ENDIF

ON ERROR END

*If <NetBSD$FastBoot> > 0 then RMLoad <BtNetBSD$Dir>.Banner