Fully synchronize sys/boot from FreeBSD-5.x, but add / to the module path
[dragonfly.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: src/sys/boot/pc98/boot0.5/support.s,v 1.1 2000/08/02 08:46:08 kato Exp $
29 # $DragonFly: src/sys/boot/pc98/boot0.5/Attic/support.s,v 1.3 2003/11/10 06:08:38 dillon Exp $
30 #
31
32         .code16
33
34         .text
35 #
36 # Wait 1ms
37 #
38         .global wait1ms
39 wait1ms:
40         push    %cx
41         movw    $800, %cx
42 wait_loop:
43         outb    %al, $0x5f
44         loop    wait_loop
45         pop     %cx
46         ret
47
48 #
49 # Read one byte from BIOS parameter block
50 #       %bx     offset
51 #       %dl     value
52 #
53         .global read_biosparam
54 read_biosparam:
55         movb    %es:(%bx), %dl
56         ret
57
58 #
59 # Write one byte to BIOS paramter block
60 #       %bx     offset
61 #       %dl     value
62 #
63         .global write_biosparam
64 write_biosparam:
65         movb    %dl, %es:(%bx)
66         ret
67
68 #
69 # beep
70 #
71         .global beep_on, beep_off, beep
72 beep_on:
73         movb    $0x17, %ah
74         int     $0x18
75         ret
76
77 beep_off:
78         movb    $0x18, %ah
79         int     $0x18
80         ret
81
82 beep:
83         push    %cx
84         call    beep_on
85         movw    $100, %cx
86 beep_loop1:
87         call    wait1ms
88         loop    beep_loop1
89         call    beep_off
90         movw    $50, %cx
91 beep_loop2:
92         call    wait1ms
93         loop    beep_loop2
94         pop     %cx
95         ret