source: xtideuniversalbios/tags/v2.0.0_beta_2/Assembly_Library/Src/Util/Registers.asm@ 463

Last change on this file since 463 was 376, checked in by gregli@…, 12 years ago

WIDE checkin... Added copyright and license information to sorce files, as per the GPL instructions for usage.

File size: 3.2 KB
Line 
1; Project name : Assembly Library
2; Description : Functions for register operations.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
12;
13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16; GNU General Public License for more details.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20; Section containing code
21SECTION .text
22
23;--------------------------------------------------------------------
24; Registers_ExchangeDSSIwithESDI
25; Parameters
26; Nothing
27; Returns:
28; DS:SI and ES:DI are exchanged.
29; Corrupts registers:
30; Nothing
31;--------------------------------------------------------------------
32ALIGN JUMP_ALIGN
33Registers_ExchangeDSSIwithESDI:
34 push ds
35 push es
36 pop ds
37 pop es
38 xchg si, di
39 ret
40
41
42;--------------------------------------------------------------------
43; Registers_CopySSBPtoESDI
44; Registers_CopySSBPtoDSSI
45; Registers_CopyDSSItoESDI
46; Registers_CopyESDItoDSSI
47; Parameters
48; Nothing
49; Returns:
50; Copies farm pointer to different segment/pointer register pair
51; Corrupts registers:
52; Nothing
53;--------------------------------------------------------------------
54ALIGN JUMP_ALIGN
55Registers_CopySSBPtoESDI:
56 COPY_SSBP_TO_ESDI
57 ret
58
59%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
60ALIGN JUMP_ALIGN
61Registers_CopySSBPtoDSSI:
62 COPY_SSBP_TO_DSSI
63 ret
64
65ALIGN JUMP_ALIGN
66Registers_CopyDSSItoESDI:
67 COPY_DSSI_TO_ESDI
68 ret
69
70ALIGN JUMP_ALIGN
71Registers_CopyESDItoDSSI:
72 COPY_ESDI_to_DSSI
73 ret
74%endif
75
76
77;--------------------------------------------------------------------
78; Registers_NormalizeESSI
79; Registers_NormalizeESDI
80; Parameters
81; DS:SI or ES:DI: Ptr to normalize
82; Returns:
83; DS:SI or ES:DI: Normalized pointer
84; Corrupts registers:
85; AX, CX
86;
87; Inline of NORMALIZE_FAR_POINTER so that we can share the last 2/3 of the
88; routine with Registers_NormalizeFinish.
89;
90;--------------------------------------------------------------------
91%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
92ALIGN JUMP_ALIGN
93Registers_NormalizeESSI:
94 mov cx, si
95 and si, byte 0fh
96 jmp Registers_NormalizeFinish
97
98ALIGN JUMP_ALIGN
99Registers_NormalizeESDI:
100 mov cx, di
101 and di, byte 0fh
102;;; fall-through
103
104ALIGN JUMP_ALIGN
105Registers_NormalizeFinish:
106 eSHR_IM cx, 4
107 mov ax, es
108 add ax, cx
109 mov es, ax
110 ret
111%endif
112
113
114;--------------------------------------------------------------------
115; Registers_SetZFifNullPointerInDSSI (commented to save bytes)
116; Parameters
117; DS:SI: Far pointer
118; Returns:
119; ZF: Set if NULL pointer in DS:SI
120; Corrupts registers:
121; Nothing
122;--------------------------------------------------------------------
123;ALIGN JUMP_ALIGN
124;Registers_SetZFifNullPointerInDSSI:
125; push ax
126; mov ax, ds
127; or ax, si
128; pop ax
129; ret
Note: See TracBrowser for help on using the repository browser.