source: xtideuniversalbios/trunk/Assembly_Library/Src/Util/Math.asm@ 339

Last change on this file since 339 was 336, checked in by gregli@…, 13 years ago

Removed %ifdef that was preventing the configuration from building in Math.asm, added copyright and license information to configurator (boots to information).

File size: 1.4 KB
Line 
1; Project name : Assembly Library
2; Description : Functions for register operations.
3
4
5; Section containing code
6SECTION .text
7
8;--------------------------------------------------------------------
9; Math_DivQWatSSBPbyCX
10; Parameters:
11; [SS:BP]: 64-bit unsigned divident
12; CX: 16-bit unsigned divisor
13; Returns:
14; [SS:BP]: 64-bit unsigned quotient
15; DX: 16-bit unsigned remainder
16; Corrupts registers:
17; AX
18;--------------------------------------------------------------------
19ALIGN JUMP_ALIGN
20Math_DivQWatSSBPbyCX:
21 xor dx, dx
22 mov ax, [bp+6] ; Load highest divident WORD to DX:AX
23 div cx
24 mov [bp+6], ax ; Store quotient
25
26 mov ax, [bp+4]
27 div cx
28 mov [bp+4], ax
29
30 mov ax, [bp+2]
31 div cx
32 mov [bp+2], ax
33
34 mov ax, [bp]
35 div cx
36 mov [bp], ax
37 ret
38
39
40;--------------------------------------------------------------------
41; Math_DivDXAXbyCX
42; Parameters:
43; DX:AX: 32-bit unsigned divident
44; CX: 16-bit unsigned divisor
45; Returns:
46; DX:AX: 32-bit unsigned quotient
47; BX: 16-bit unsigned remainder
48; Corrupts registers:
49; Nothing
50;--------------------------------------------------------------------
51%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
52ALIGN JUMP_ALIGN
53Math_DivDXAXbyCX: ; This is currently unused (dead code)
54 xor bx, bx
55 xchg bx, ax
56 xchg dx, ax
57 div cx
58 xchg ax, bx
59 div cx
60 xchg dx, bx
61 ret
62%endif
Note: See TracBrowser for help on using the repository browser.