source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm@ 569

Last change on this file since 569 was 567, checked in by krille_n_@…, 10 years ago

Changes:

  • Renamed MODULE_FEATURE_SETS to MODULE_POWER_MANAGEMENT.
  • Renamed MODULE_VERY_LATE_INITIALIZATION to MODULE_VERY_LATE_INIT and removed it from the official builds.
  • Removed the code that skips detection of slave drives on XT-CF controllers since slave drives can be used with Lo-tech ISA CompactFlash boards.
  • Added autodetection of the SVC ADP50L controller to XTIDECFG.
  • The autodetection of XT-CF controllers now requires MODULE_8BIT_IDE_ADVANCED in the loaded BIOS.
  • Fixed a bug in XTIDECFG from r502 where the "Base (cmd block) address" menu option would be displayed when a serial device was selected as the IDE controller.
  • XTIDECFG would display the "Enable interrupt" menu option for the XTIDE r1 but not for the XTIDE r2. It's now displayed for both controller types.
  • Disabled the "Internal Write Cache" menu option in the Master/Slave Drive menus for serial device type drives.
  • Optimizations and other fixes.
File size: 5.6 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Functions for accessings RAMVARS.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 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; Initializes RAMVARS.
25; Drive detection can be started after this function returns.
26;
27; RamVars_Initialize
28; Parameters:
29; Nothing
30; Returns:
31; DS: RAMVARS segment
32; Corrupts registers:
33; AX, CX, DI
34;--------------------------------------------------------------------
35RamVars_Initialize:
36 push es
37 ; Fall to .StealMemoryForRAMVARS
38
39;--------------------------------------------------------------------
40; .StealMemoryForRAMVARS
41; Parameters:
42; Nothing
43; Returns:
44; DS: RAMVARS segment
45; Corrupts registers:
46; AX, CL
47;--------------------------------------------------------------------
48.StealMemoryForRAMVARS:
49%ifndef USE_AT
50 mov ax, LITE_MODE_RAMVARS_SEGMENT
51 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
52 jz SHORT .InitializeRamvars ; No need to steal RAM
53%endif
54
55 LOAD_BDA_SEGMENT_TO ds, ax, ! ; Zero AX
56 mov al, [cs:ROMVARS.bStealSize]
57 sub [BDA.wBaseMem], ax
58 mov ax, [BDA.wBaseMem]
59%ifdef USE_186
60 shl ax, 6 ; Segment to first stolen kB (*=40h)
61%else
62 mov cl, 6
63 shl ax, cl
64%endif
65 ; Fall to .InitializeRamvars
66
67;--------------------------------------------------------------------
68; .InitializeRamvars
69; Parameters:
70; AX: RAMVARS segment
71; Returns:
72; DS: RAMVARS segment
73; Corrupts registers:
74; AX, CX, DI, ES
75;--------------------------------------------------------------------
76.InitializeRamvars:
77 mov ds, ax
78 mov es, ax
79 mov cx, RAMVARS_size
80 xor di, di
81 call Memory_ZeroESDIwithSizeInCX
82 mov WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE
83 mov WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE
84%ifdef MODULE_DRIVEXLATE
85 call DriveXlate_Reset
86%endif
87
88 pop es
89 ret
90
91;--------------------------------------------------------------------
92; Returns segment to RAMVARS.
93; RAMVARS might be located at the top of interrupt vectors (0030:0000h)
94; or at the top of system base RAM.
95;
96; RamVars_GetSegmentToDS
97; Parameters:
98; Nothing
99; Returns:
100; DS: RAMVARS segment
101; Corrupts registers:
102; DI
103;--------------------------------------------------------------------
104ALIGN JUMP_ALIGN
105RamVars_GetSegmentToDS:
106
107%ifndef USE_AT ; Always in Full Mode for AT builds
108 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
109 jnz SHORT .GetStolenSegmentToDS
110 %ifndef USE_186
111 mov di, LITE_MODE_RAMVARS_SEGMENT
112 mov ds, di
113 %else
114 push LITE_MODE_RAMVARS_SEGMENT
115 pop ds
116 %endif
117 ret
118%endif
119
120ALIGN JUMP_ALIGN
121.GetStolenSegmentToDS:
122 LOAD_BDA_SEGMENT_TO ds, di
123 mov di, [BDA.wBaseMem] ; Load available base memory size in kB
124 eSHL_IM di, 6 ; Segment to first stolen kB (*=40h)
125ALIGN JUMP_ALIGN
126.LoopStolenKBs:
127 mov ds, di ; EBDA segment to DS
128 add di, BYTE 64 ; DI to next stolen kB
129 cmp WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE
130 jne SHORT .LoopStolenKBs ; Loop until sign found (always found eventually)
131 ret
132
133
134;--------------------------------------------------------------------
135; RamVars_GetHardDiskCountFromBDAtoAX
136; Parameters:
137; DS: RAMVARS segment
138; Returns:
139; AX: Total hard disk count
140; Corrupts registers:
141; BX
142;--------------------------------------------------------------------
143%ifdef MODULE_BOOT_MENU
144RamVars_GetHardDiskCountFromBDAtoAX:
145 call RamVars_GetCountOfKnownDrivesToAX
146 push ds
147 LOAD_BDA_SEGMENT_TO ds, bx
148 mov bl, [BDA.bHDCount]
149 MAX_U al, bl
150 pop ds
151 ret
152%endif
153
154
155;--------------------------------------------------------------------
156; RamVars_GetCountOfKnownDrivesToAX
157; Parameters:
158; DS: RAMVARS segment
159; Returns:
160; AX: Total hard disk count
161; Corrupts registers:
162; None
163;--------------------------------------------------------------------
164ALIGN JUMP_ALIGN
165RamVars_GetCountOfKnownDrivesToAX:
166 mov ax, [RAMVARS.wFirstDrvAndCount]
167 add al, ah
168 and ax, BYTE 7fh
169 ret
170
171;--------------------------------------------------------------------
172; RamVars_GetIdeControllerCountToCX
173; Parameters:
174; Nothing
175; Returns:
176; CX: Number of IDE controllers to handle
177; Corrupts registers:
178; Nothing
179;--------------------------------------------------------------------
180ALIGN JUMP_ALIGN
181RamVars_GetIdeControllerCountToCX:
182 eMOVZX cx, [cs:ROMVARS.bIdeCnt]
183 ret
184
185
186%ifdef MODULE_SERIAL_FLOPPY
187;--------------------------------------------------------------------
188; RamVars_UnpackFlopCntAndFirstToAL
189; Parameters:
190; DS: RAMVARS segment
191; Returns:
192; AL: First floppy drive number supported
193; CF: Number of floppy drives supported (clear = 1, set = 2)
194; SF: Emulating drives (clear = yes, set = no)
195; Corrupts registers:
196; Nothing
197;--------------------------------------------------------------------
198ALIGN JUMP_ALIGN
199RamVars_UnpackFlopCntAndFirstToAL:
200 mov al, [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst]
201 sar al, 1
202 ret
203%endif
Note: See TracBrowser for help on using the repository browser.