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

Last change on this file since 577 was 567, checked in by krille_n_@…, 11 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
RevLine 
[90]1; Project name : XTIDE Universal BIOS
[3]2; Description : Functions for accessings RAMVARS.
3
[376]4;
[505]5; XTIDE Universal BIOS and Associated Tools
[526]6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
[376]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.
[505]12;
[376]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
[505]16; GNU General Public License for more details.
[376]17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
[505]18;
[376]19
[3]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:
[97]31; DS: RAMVARS segment
[3]32; Corrupts registers:
[97]33; AX, CX, DI
[3]34;--------------------------------------------------------------------
35RamVars_Initialize:
[90]36 push es
[97]37 ; Fall to .StealMemoryForRAMVARS
[3]38
39;--------------------------------------------------------------------
[33]40; .StealMemoryForRAMVARS
[3]41; Parameters:
42; Nothing
43; Returns:
44; DS: RAMVARS segment
45; Corrupts registers:
[567]46; AX, CL
[3]47;--------------------------------------------------------------------
[33]48.StealMemoryForRAMVARS:
[400]49%ifndef USE_AT
[241]50 mov ax, LITE_MODE_RAMVARS_SEGMENT
[3]51 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
[97]52 jz SHORT .InitializeRamvars ; No need to steal RAM
[364]53%endif
[3]54
[116]55 LOAD_BDA_SEGMENT_TO ds, ax, ! ; Zero AX
[3]56 mov al, [cs:ROMVARS.bStealSize]
[33]57 sub [BDA.wBaseMem], ax
[567]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
[150]65 ; Fall to .InitializeRamvars
[3]66
[33]67;--------------------------------------------------------------------
[97]68; .InitializeRamvars
[33]69; Parameters:
[241]70; AX: RAMVARS segment
[97]71; Returns:
[33]72; DS: RAMVARS segment
73; Corrupts registers:
74; AX, CX, DI, ES
75;--------------------------------------------------------------------
[97]76.InitializeRamvars:
[241]77 mov ds, ax
78 mov es, ax
[97]79 mov cx, RAMVARS_size
80 xor di, di
81 call Memory_ZeroESDIwithSizeInCX
[444]82 mov WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE
83 mov WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE
[556]84%ifdef MODULE_DRIVEXLATE
85 call DriveXlate_Reset
86%endif
[505]87
[97]88 pop es
[395]89 ret
[33]90
[3]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:
[368]106
[400]107%ifndef USE_AT ; Always in Full Mode for AT builds
[3]108 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
[33]109 jnz SHORT .GetStolenSegmentToDS
[400]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
[181]118%endif
[3]119
120ALIGN JUMP_ALIGN
[33]121.GetStolenSegmentToDS:
[3]122 LOAD_BDA_SEGMENT_TO ds, di
123 mov di, [BDA.wBaseMem] ; Load available base memory size in kB
[33]124 eSHL_IM di, 6 ; Segment to first stolen kB (*=40h)
[3]125ALIGN JUMP_ALIGN
126.LoopStolenKBs:
127 mov ds, di ; EBDA segment to DS
128 add di, BYTE 64 ; DI to next stolen kB
[444]129 cmp WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE
[3]130 jne SHORT .LoopStolenKBs ; Loop until sign found (always found eventually)
131 ret
132
133
134;--------------------------------------------------------------------
[258]135; RamVars_GetHardDiskCountFromBDAtoAX
[3]136; Parameters:
137; DS: RAMVARS segment
138; Returns:
[258]139; AX: Total hard disk count
[3]140; Corrupts registers:
[492]141; BX
[116]142;--------------------------------------------------------------------
[392]143%ifdef MODULE_BOOT_MENU
[258]144RamVars_GetHardDiskCountFromBDAtoAX:
145 call RamVars_GetCountOfKnownDrivesToAX
[294]146 push ds
[505]147 LOAD_BDA_SEGMENT_TO ds, bx
[492]148 mov bl, [BDA.bHDCount]
149 MAX_U al, bl
[294]150 pop ds
[3]151 ret
[392]152%endif
[32]153
[392]154
[32]155;--------------------------------------------------------------------
[258]156; RamVars_GetCountOfKnownDrivesToAX
[32]157; Parameters:
158; DS: RAMVARS segment
159; Returns:
[258]160; AX: Total hard disk count
[32]161; Corrupts registers:
[258]162; None
[116]163;--------------------------------------------------------------------
[32]164ALIGN JUMP_ALIGN
[258]165RamVars_GetCountOfKnownDrivesToAX:
[433]166 mov ax, [RAMVARS.wFirstDrvAndCount]
[258]167 add al, ah
[368]168 and ax, BYTE 7fh
[32]169 ret
[294]170
[33]171;--------------------------------------------------------------------
172; RamVars_GetIdeControllerCountToCX
173; Parameters:
174; Nothing
175; Returns:
176; CX: Number of IDE controllers to handle
177; Corrupts registers:
178; Nothing
[116]179;--------------------------------------------------------------------
[258]180ALIGN JUMP_ALIGN
[33]181RamVars_GetIdeControllerCountToCX:
[294]182 eMOVZX cx, [cs:ROMVARS.bIdeCnt]
[33]183 ret
[258]184
[473]185
[258]186%ifdef MODULE_SERIAL_FLOPPY
187;--------------------------------------------------------------------
188; RamVars_UnpackFlopCntAndFirstToAL
189; Parameters:
[473]190; DS: RAMVARS segment
[258]191; Returns:
192; AL: First floppy drive number supported
[567]193; CF: Number of floppy drives supported (clear = 1, set = 2)
[270]194; SF: Emulating drives (clear = yes, set = no)
[258]195; Corrupts registers:
196; Nothing
[294]197;--------------------------------------------------------------------
[258]198ALIGN JUMP_ALIGN
199RamVars_UnpackFlopCntAndFirstToAL:
200 mov al, [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst]
[294]201 sar al, 1
[258]202 ret
203%endif
Note: See TracBrowser for help on using the repository browser.