Last change
on this file since 91942 was 86686, checked in by vboxsync, 4 years ago |
BIOS: Only use the .8086 directive when assembling using WASM; MASM no longer understands it and errors out.
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
2.2 KB
|
Line | |
---|
1 | ; $Id: __I4D.asm 86686 2020-10-23 13:13:34Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; Compiler support routines.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2012-2020 Oracle Corporation
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
11 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | ; General Public License (GPL) as published by the Free Software
|
---|
13 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | ;
|
---|
17 |
|
---|
18 |
|
---|
19 | ;*******************************************************************************
|
---|
20 | ;* Exported Symbols *
|
---|
21 | ;*******************************************************************************
|
---|
22 | public __I4D
|
---|
23 |
|
---|
24 | if VBOX_BIOS_CPU lt 80386
|
---|
25 | extrn NeedToImplementOn8086__I4D:near
|
---|
26 | endif
|
---|
27 |
|
---|
28 | ; MASM (ML.EXE) is used for PXE and no longer understands the .8086 directive.
|
---|
29 | ; WASM is used for the BIOS and understands it just fine.
|
---|
30 | ifdef __WASM__
|
---|
31 | .8086
|
---|
32 | endif
|
---|
33 |
|
---|
34 |
|
---|
35 | _TEXT segment public 'CODE' use16
|
---|
36 | assume cs:_TEXT
|
---|
37 |
|
---|
38 | ;;
|
---|
39 | ; 32-bit signed division.
|
---|
40 | ;
|
---|
41 | ; @param dx:ax Dividend.
|
---|
42 | ; @param cx:bx Divisor.
|
---|
43 | ; @returns dx:ax Quotient.
|
---|
44 | ; cx:bx Remainder.
|
---|
45 | ;
|
---|
46 | __I4D:
|
---|
47 | pushf
|
---|
48 | if VBOX_BIOS_CPU ge 80386
|
---|
49 | .386
|
---|
50 | push eax
|
---|
51 | push edx
|
---|
52 | push ecx
|
---|
53 |
|
---|
54 | rol eax, 16
|
---|
55 | mov ax, dx
|
---|
56 | ror eax, 16
|
---|
57 | xor edx, edx
|
---|
58 |
|
---|
59 | shr ecx, 16
|
---|
60 | mov cx, bx
|
---|
61 |
|
---|
62 | idiv ecx ; eax:edx / ecx -> eax=quotient, edx=remainder.
|
---|
63 |
|
---|
64 | mov bx, dx
|
---|
65 | pop ecx
|
---|
66 | shr edx, 16
|
---|
67 | mov cx, dx
|
---|
68 |
|
---|
69 | pop edx
|
---|
70 | ror eax, 16
|
---|
71 | mov dx, ax
|
---|
72 | add sp, 2
|
---|
73 | pop ax
|
---|
74 | rol eax, 16
|
---|
75 | ifdef __WASM__
|
---|
76 | .8086
|
---|
77 | endif
|
---|
78 |
|
---|
79 | else
|
---|
80 | call NeedToImplementOn8086__I4D
|
---|
81 | endif
|
---|
82 | popf
|
---|
83 | ret
|
---|
84 |
|
---|
85 |
|
---|
86 | _TEXT ends
|
---|
87 | end
|
---|
88 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.