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

Last change on this file since 625 was 625, checked in by Krister Nordvall, 22 months ago

Changes:

  • Added a configuration option to let the BIOS store RamVars to an UMB when Full operating mode is enabled. This is primarily for XT class machines with RAM in the UMA (which apparently is a common thing these days).
  • Added two new builds specifically for IBM PS/2 machines. This is for support of the new McIDE adapter from the guys at zzxio.com. Note that the additional hardware specific code (under the USE_PS2 define) is for the PS/2 machines themselves and not for the McIDE adapters, so any controller in an IBM PS/2 machine can be used with the USE_PS2 define.
  • Moved pColorTheme out of the range of ROMVARS being copied over when doing "Load old settings from EEPROM" in XTIDECFG. This fixed a serious bug from r592 where loading a BIOS from file and then loading the old settings from ROM would corrupt 7 bytes of code somewhere in the loaded BIOS.
  • Optimizations (speed and size) to the library. Browsing the menus in XTIDECFG should now feel a little less sluggish.
  • Hopefully fixed a problem with the PostCommitHook script where it sometimes wouldn't find the CommitInProgress file. I say hopefully because testing this is a nightmare.
File size: 4.8 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-2023 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, DX, DI
34;--------------------------------------------------------------------
35RamVars_Initialize:
36 push es
37
38 mov ax, [cs:ROMVARS.wRamVars]
39 test ax, ax ; UMB segment or LITE_MODE_RAMVARS_SEGMENT?
40 jnz SHORT .InitializeRamvars ; No need to steal RAM
41
42 mov ds, ax
43 mov al, [cs:ROMVARS.bStealSize]
44 sub [BDA.wBaseMem], ax
45%ifdef USE_186
46 imul ax, [BDA.wBaseMem], 64
47%else
48 mov al, 64
49 mul WORD [BDA.wBaseMem]
50%endif
51
52.InitializeRamvars:
53 xor di, di
54 mov ds, ax
55 mov es, ax
56 mov cx, RAMVARS_size
57 call Memory_ZeroESDIwithSizeInCX
58 mov WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE
59 mov WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE
60%ifdef MODULE_DRIVEXLATE
61 call DriveXlate_Reset
62%endif
63
64 pop es
65 ret
66
67
68;--------------------------------------------------------------------
69; Returns segment to RAMVARS.
70; RAMVARS might be located at the top of interrupt vectors (0030:0000h),
71; at the top of system base RAM or in a user configured UMB.
72;
73; RamVars_GetSegmentToDS
74; Parameters:
75; Nothing
76; Returns:
77; DS: RAMVARS segment
78; Corrupts registers:
79; DI
80;--------------------------------------------------------------------
81ALIGN JUMP_ALIGN
82RamVars_GetSegmentToDS:
83 mov ds, [cs:ROMVARS.wRamVars]
84 mov di, ds
85 test di, di ; UMB segment or LITE_MODE_RAMVARS_SEGMENT?
86 jnz SHORT .Return
87
88;%ifdef USE_186
89; imul di, [BDA.wBaseMem], 64 ; 2 bytes less but slower, especially on 386/486 processors
90;%else
91 mov di, [BDA.wBaseMem] ; Load available base memory size in kB
92 eSHL_IM di, 6 ; Segment to first stolen kB (*=40h)
93;%endif
94ALIGN JUMP_ALIGN
95.LoopStolenKBs:
96 mov ds, di ; EBDA segment to DS
97 add di, BYTE 64 ; DI to next stolen kB
98 cmp WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE
99 jne SHORT .LoopStolenKBs ; Loop until sign found (always found eventually)
100.Return:
101 ret
102
103
104;--------------------------------------------------------------------
105; RamVars_GetHardDiskCountFromBDAtoAX
106; Parameters:
107; DS: RAMVARS segment
108; Returns:
109; AX: Total hard disk count
110; Corrupts registers:
111; BX
112;--------------------------------------------------------------------
113%ifdef MODULE_BOOT_MENU
114RamVars_GetHardDiskCountFromBDAtoAX:
115 call RamVars_GetCountOfKnownDrivesToAX
116 push ds
117 LOAD_BDA_SEGMENT_TO ds, bx
118 mov bl, [BDA.bHDCount]
119 MAX_U al, bl
120 pop ds
121 ret
122%endif
123
124
125%ifdef MODULE_SERIAL_FLOPPY
126;--------------------------------------------------------------------
127; RamVars_UnpackFlopCntAndFirstToAL
128; Parameters:
129; DS: RAMVARS segment
130; Returns:
131; AL: First floppy drive number supported
132; CF: Number of floppy drives supported (clear = 1, set = 2)
133; SF: Emulating drives (clear = yes, set = no)
134; Corrupts registers:
135; Nothing
136;--------------------------------------------------------------------
137ALIGN JUMP_ALIGN
138RamVars_UnpackFlopCntAndFirstToAL:
139 mov al, [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst]
140 sar al, 1
141 ret
142%endif
143
144
145;--------------------------------------------------------------------
146; RamVars_GetIdeControllerCountToCX
147; Parameters:
148; Nothing
149; Returns:
150; CX: Number of IDE controllers to handle
151; Corrupts registers:
152; Nothing
153;--------------------------------------------------------------------
154ALIGN JUMP_ALIGN
155RamVars_GetIdeControllerCountToCX:
156 eMOVZX cx, [cs:ROMVARS.bIdeCnt]
157 ret
158
159
160;--------------------------------------------------------------------
161; RamVars_GetCountOfKnownDrivesToAX
162; Parameters:
163; DS: RAMVARS segment
164; Returns:
165; AX: Total hard disk count
166; Corrupts registers:
167; None
168;--------------------------------------------------------------------
169ALIGN JUMP_ALIGN
170RamVars_GetCountOfKnownDrivesToAX:
171 mov ax, [RAMVARS.wFirstDrvAndCount]
172 add al, ah
173 and ax, BYTE 7Fh
174 ret
Note: See TracBrowser for help on using the repository browser.