1REM > bb_NetBSD 2REM $NetBSD: bb_netbsd,v 1.1.1.1 2002/05/09 20:03:57 jdolecek Exp $ 3REM 4REM Copyright (c) 1995 Mark Brinicombe 5REM All rights reserved 6REM 7REM Redistribution and use in source and binary forms, with or without 8REM modification, are permitted provided that the following conditions 9REM are met: 10REM 1. Redistributions of source code must retain the above copyright 11REM notice, this list of conditions and the following disclaimer. 12REM 2. Redistributions in binary form must reproduce the above copyright 13REM notice, this list of conditions and the following disclaimer in the 14REM documentation and/or other materials provided with the distribution. 15REM 3. All advertising materials mentioning features or use of this software 16REM must display the following acknowledgement: 17REM This product includes software developed by Mark Brinicombe. 18REM 4. The name of the company nor the name of the author may be used to 19REM endorse or promote products derived from this software without specific 20REM prior written permission. 21REM 22REM THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23REM IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24REM OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25REM IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26REM INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27REM BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 28REM OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29REM ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 30REM OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 31REM THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 32REM DAMAGE. 33REM 34REM NetBSD kernel project 35REM 36REM bb_NetBSD 37REM 38REM Modifies the filecore bootblock to point to a section of 39REM the disc reserved for NetBSD. 40REM 41REM Created : 24/11/94 42REM Last updated : 12/07/95 43REM 44 45DIM buf% 512 46 47REM Get Filesystem type 48 49REPEAT 50 PRINT "ADFS, ATAFS, IDEFS, SCSI or SCSIFS (A/T/I/S/F) ? "; 51 filesys% = GET AND &DF 52 PRINT CHR$(filesys%) 53UNTIL filesys%=ASC"A" OR filesys%=ASC"T" OR filesys%=ASC"S" OR filesys%=ASC"I" OR filesys%=ASC"F" 54 55CASE filesys% OF 56 WHEN ASC"A" : discop$="ADFS_DiscOp" 57 WHEN ASC"I" : discop$="IDEFS_DiscOp" 58 WHEN ASC"T" : discop$="ATAFS_DiscOp" 59 WHEN ASC"S" : discop$="SCSI_DiscOp" 60 WHEN ASC"F" : discop$="SCSIFS_DiscOp" 61ENDCASE 62 63REM Get the drive number 64 65INPUT "Drive "d% 66 67REM Read in current filecore bootblock 68 69SYS discop$,, 1, &c00 + (d% << 29), buf%, 512 70 71SYS "OS_File", 10, "<Wimp$ScrapDir>.OldBB", &FFD,, buf%, buf%+512 72PRINT "Old boot block saved in <Wimp$ScrapDir>.OldBB" 73 74REM Get the byte size of the filecore partition and the number 75REM of bytes per cylinder 76 77size%=buf%!&1d0 78clsize%=buf%?&1c2 * buf%?&1c1 * (1 << buf%?&1c0) 79 80REM A bit of info to the user 81 82PRINT "Filecore partition size = ";~size%;" bytes" 83 84REM Convert the size into cylinders 85 86size% = (size% + clsize% - 1) / clsize% 87 88PRINT "Filecore partition size = ";size%; " cylinders (0-";size%-1;")" 89 90REM We should be clever about here and read the real geometry 91REM of the disc so that we know the maximum cylinder number 92 93REM Get the starting cylinder for the NetBSD part of the disc 94 95INPUT "NetBSD Starting Cyl "c% 96 97REM Make sure it is after the filecore partition 98 99IF (c% < size%) THEN 100 PRINT "Filecore occupies cylinders upto ";size%-1 101 INPUT "Are you sure you mean this value "a$ 102 IF (a$ <> "yes" AND a$ <> "YES") THEN END 103 PRINT "This will allow NetBSD to overwrite part of the ADFS partition" 104 INPUT "Are you really sure you mean this value "a$ 105 IF (a$ <> "yes" AND a$ <> "YES") THEN END 106ENDIF 107 108PRINT "Initialising NetBSD partition offset at ";c% 109PRINT "On drive ";d%;", using ";discop$;" to access drive" 110PRINT "Press any key to continue, escape to abort" 111 112dummy%=GET 113 114REM Modifiy the non-ADFS partition descriptor to describe the 115REM start of the NetBSD part of the disc 116 117buf%?&1FC = &42 : REM NetBSD identifier 118buf%?&1FD = c% AND 255 : REM low byte of start cylinder 119buf%?&1FE = c% >> 8 : REM high byte of start cylinder 120 121REM Recalculate the filecore boot block checksum 122 123buf%?&1FF = FNCheckSum(buf%,511) 124 125REM Write the boot block back to disc 126 127SYS discop$,, 2, &c00 + (d% << 29), buf%, 512 128 129END 130 131 132DEF FNCheckSum(addr%, length%) 133sum% = 0 134FOR n% = 0 TO length% - 1 135 sum% += addr%?n% 136 IF sum% > 255 THEN 137 sum% -= 255 138 ENDIF 139NEXT 140= sum% 141