]>
Commit | Line | Data |
---|---|---|
14c7c974 A |
1 | ; Copyright (c) 1999 Apple Computer, Inc. All rights reserved. |
2 | ; | |
3 | ; @APPLE_LICENSE_HEADER_START@ | |
4 | ; | |
4f6e3300 A |
5 | ; Portions Copyright (c) 1999 Apple Computer, Inc. All Rights |
6 | ; Reserved. This file contains Original Code and/or Modifications of | |
7 | ; Original Code as defined in and that are subject to the Apple Public | |
8 | ; Source License Version 1.1 (the "License"). You may not use this file | |
9 | ; except in compliance with the License. Please obtain a copy of the | |
10 | ; License at http://www.apple.com/publicsource and read it before using | |
11 | ; this file. | |
14c7c974 A |
12 | ; |
13 | ; The Original Code and all software distributed under the License are | |
4f6e3300 | 14 | ; distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
14c7c974 A |
15 | ; EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
16 | ; INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
4f6e3300 A |
17 | ; FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the |
18 | ; License for the specific language governing rights and limitations | |
19 | ; under the License. | |
14c7c974 A |
20 | ; |
21 | ; @APPLE_LICENSE_HEADER_END@ | |
22 | ; | |
23 | ; nullboot.s - boot1 written for nasm assembler, since gas only | |
24 | ; generates 32 bit code and this must run in real mode. | |
25 | ; To compile as floppy boot1f.not: | |
26 | ; nasm -dBOOTDEV=FLOPPY nullboot1.s -o nullboot1 | |
27 | ||
28 | ;*********************************************************************** | |
29 | ; This is the code for the NeXT boot1 bootsector. | |
30 | ;*********************************************************************** | |
31 | ||
32 | SEGMENT .text | |
33 | ||
34 | SDEBUG EQU 0 | |
35 | ||
36 | BOOTSEG EQU 00h | |
37 | BOOTOFF EQU 1000h | |
38 | BUFSZ EQU 2000h ; 8K disk transfer buffer | |
39 | ||
40 | ; This code is a replacement for boot1. It is loaded at 0x0:0x7c00 | |
41 | ||
42 | start: | |
43 | mov ax,BOOTSEG | |
44 | cli ; interrupts off | |
45 | mov ss,ax ; set up stack seg | |
46 | mov sp,0fff0h | |
47 | sti ; reenable interrupts | |
48 | ||
49 | xor ax,ax | |
50 | mov es,ax | |
51 | mov ds,ax | |
52 | mov si,7C00h | |
53 | cld ; so pointers will get updated | |
54 | mov di,0E000h ; relocate boot program to 0xE000 | |
55 | mov cx,100h ; copy 256x2 bytes | |
56 | repnz movsw ; move it | |
57 | jmp 0000:0E000h + (a1 - start) ; jump to a1 in relocated place | |
58 | ||
59 | a1: | |
60 | mov ax,0E00h | |
61 | mov ds,ax | |
62 | mov ax,BOOTSEG | |
63 | mov es,ax | |
64 | ||
65 | mov si, not_boot | |
66 | call message ; display intro message | |
67 | ||
68 | halt: | |
69 | mov ah, 00h | |
70 | int 16h | |
71 | jmp short halt ; get key and loop forever | |
72 | ||
73 | message: ; write the error message in ds:esi | |
74 | ; to console | |
75 | push es | |
76 | mov ax,ds | |
77 | mov es,ax | |
78 | ||
79 | mov bx, 1 ; bh=0, bl=1 (blue) | |
80 | cld | |
81 | ||
82 | nextb: | |
83 | lodsb ; load a byte into al | |
84 | cmp al, 0 | |
85 | je done | |
86 | mov ah, 0eh ; bios int 10, function 0xe | |
87 | int 10h ; bios display a byte in tty mode | |
88 | jmp short nextb | |
89 | done: pop es | |
90 | ret | |
91 | ||
92 | putchr: | |
93 | push bx | |
94 | mov bx, 1 ; bh=0, bl=1 (blue) | |
95 | mov ah, 0eh ; bios int 10, function 0xe | |
96 | int 10h ; bios display a byte in tty mode | |
97 | pop bx | |
98 | ret | |
99 | ||
100 | ||
101 | not_boot: | |
102 | db 10,13 | |
103 | db 'The disk in the floppy disk drive isn',39,'t a startup disk:' | |
104 | db 10,13 | |
105 | db 'It doesn',39,'t contain ' ; 39 = a ' char | |
106 | db 'the system files required to start up the computer.' | |
107 | db 10,13 | |
108 | db 'Please eject this disk and restart the computer' | |
109 | db ' with a floppy disk,' | |
110 | db 10,13 | |
111 | db 'hard disk, or CD-ROM that is a startup disk.' | |
112 | db 10,13 | |
113 | db 0 | |
114 | ||
115 | ; the last 2 bytes in the sector contain the signature | |
116 | d1: | |
117 | a2 equ 510 - (d1 - start) | |
118 | times a2 db 0 ; fill the rest with zeros | |
119 | dw 0AA55h | |
120 | ENDS | |
121 | END |