]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/boot/pc98/boot0.5/support.s
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / boot / pc98 / boot0.5 / support.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 #
17 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #
28 # $FreeBSD$
29 #
30
31         .code16
32
33         .text
34 #
35 # Wait 1ms
36 #
37         .global wait1ms
38 wait1ms:
39         push    %cx
40         movw    $800, %cx
41 wait_loop:
42         outb    %al, $0x5f
43         loop    wait_loop
44         pop     %cx
45         ret
46
47 #
48 # Read one byte from BIOS parameter block
49 #       %bx     offset
50 #       %dl     value
51 #
52         .global read_biosparam
53 read_biosparam:
54         movb    %es:(%bx), %dl
55         ret
56
57 #
58 # Write one byte to BIOS paramter block
59 #       %bx     offset
60 #       %dl     value
61 #
62         .global write_biosparam
63 write_biosparam:
64         movb    %dl, %es:(%bx)
65         ret
66
67 #
68 # beep
69 #
70         .global beep_on, beep_off, beep
71 beep_on:
72         movb    $0x17, %ah
73         int     $0x18
74         ret
75
76 beep_off:
77         movb    $0x18, %ah
78         int     $0x18
79         ret
80
81 beep:
82         push    %cx
83         call    beep_on
84         movw    $100, %cx
85 beep_loop1:
86         call    wait1ms
87         loop    beep_loop1
88         call    beep_off
89         movw    $50, %cx
90 beep_loop2:
91         call    wait1ms
92         loop    beep_loop2
93         pop     %cx
94         ret