]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/boot/pc98/boot0/boot0.s
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / boot / pc98 / boot0 / boot0.s
1 # Copyright (c) KATO Takenori, 1999, 2000.
2
3 # All rights reserved.  Unpublished rights reserved under the copyright
4 # laws of Japan.
5
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9
10 # 1. Redistributions of source code must retain the above copyright
11 #    notice, this list of conditions and the following disclaimer as
12 #    the first lines of this file unmodified.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 #    notice, this list of conditions and the following disclaimer in the
15 #    documentation and/or other materials provided with the distribution.
16 # 3. The name of the author may not be used to endorse or promote products
17 #    derived from this software without specific prior written permission.
18
19 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #
30 # $FreeBSD$
31
32         .globl start
33         .code16
34 start:
35         jmp     main
36
37         .org    4
38         .ascii  "IPL1"
39         .byte   0, 0, 0
40
41         .globl start
42 main:
43         xor     %ax, %ax
44         mov     %ax, %ds
45         mov     (0x584), %al            # DA/UA
46         mov     %al, %ah
47         and     $0xf0, %ah
48         cmp     $0x90, %ah
49         je      fdd
50
51         # hdd
52         mov     $6, %ah
53         mov     $0x3000, %bx
54         mov     %bx, %es
55         mov     $0x2000, %bx
56         xor     %cx, %cx
57         xor     %dx, %dx
58         xor     %bp, %bp
59         int     $0x1b
60         jc      error_hdd
61
62         push    %ax
63         mov     %es, %ax
64         add     $0x40, %ax
65         mov     %ax, %es
66         pop     %ax
67         push    %es
68         push    %bp
69         lret
70
71         # fdd
72 fdd:
73         xor     %di, %di
74 fdd_retry:
75         mov     $0xd6, %ah
76         mov     $0x3000, %bx
77         mov     %bx, %es
78         mov     $0x2000, %bx
79         mov     $0x0200, %cx
80         mov     $0x0001, %dx
81         xor     %bp, %bp
82         int     $0x1b
83         jc      error
84         push    %ax
85         mov     %es, %ax
86         add     $0x40, %ax
87         mov     %ax, %es
88         pop     %ax
89         push    %es
90         push    %bp
91         lret
92
93 error:
94         or      %di, %di
95         jnz     error_hdd
96         and     $0x0f, %al
97         or      $0x30, %al
98         jmp     fdd_retry
99         
100 error_hdd:
101         jmp     error
102
103         .org    0x1fa
104         .byte   0                       # defflag_off
105         .byte   0                       # defpart_off
106         .byte   1                       # menu version
107         .byte   0
108         .word   0xaa55