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