Changeset 33 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
- Timestamp:
- Aug 23, 2010, 4:27:11 PM (14 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
r32 r33 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 14.3.2010 4 ; Last update : 3.8.20104 ; Last update : 23.8.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for accessings RAMVARS. … … 23 23 ALIGN JUMP_ALIGN 24 24 RamVars_Initialize: 25 call RamVars_StealBaseMemory; Get RAMVARS segment to DS even if no stealing26 call RamVars_ClearToZero25 call .StealMemoryForRAMVARS ; Get RAMVARS segment to DS even if no stealing 26 call .ClearRamvarsFromDS 27 27 jmp DriveXlate_Reset 28 28 29 30 ;-------------------------------------------------------------------- 31 ; Steals base memory to be used for RAMVARS. 32 ; 33 ; RamVars_StealBaseMemory 29 ;-------------------------------------------------------------------- 30 ; .StealMemoryForRAMVARS 34 31 ; Parameters: 35 32 ; Nothing … … 40 37 ;-------------------------------------------------------------------- 41 38 ALIGN JUMP_ALIGN 42 RamVars_StealBaseMemory:39 .StealMemoryForRAMVARS: 43 40 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE 44 jz SHORT RamVars_GetSegmentToDS ; No need to steal45 46 LOAD_BDA_SEGMENT_TO ds, ax 41 jz SHORT RamVars_GetSegmentToDS 42 43 LOAD_BDA_SEGMENT_TO ds, ax ; Zero AX 47 44 mov al, [cs:ROMVARS.bStealSize] 48 sub [BDA.wBaseMem], ax ; Steal one or more kilobytes 49 mov ax, [BDA.wBaseMem] ; Load base memory left 50 eSHL_IM ax, 6 ; Shift for segment address 51 mov ds, ax ; Copy RAMVARS segment to DS 52 ret 53 54 55 ;-------------------------------------------------------------------- 56 ; Returns segment to RAMVARS. 57 ; RAMVARS might be located at the top of interrupt vectors (0030:0000h) 58 ; or at the top of system base RAM. 59 ; 60 ; RamVars_GetSegmentToDS 61 ; Parameters: 62 ; Nothing 63 ; Returns: 64 ; DS: RAMVARS segment 65 ; Corrupts registers: 66 ; DI 67 ;-------------------------------------------------------------------- 68 ALIGN JUMP_ALIGN 69 RamVars_GetSegmentToDS: 70 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE 71 jnz SHORT RamVars_GetStolenSegmentToDS 72 mov di, SEGMENT_RAMVARS_TOP_OF_INTERRUPT_VECTORS 73 mov ds, di 74 ret 75 76 ALIGN JUMP_ALIGN 77 RamVars_GetStolenSegmentToDS: 78 LOAD_BDA_SEGMENT_TO ds, di 79 mov di, [BDA.wBaseMem] ; Load available base memory size in kB 80 eSHL_IM di, 6 ; Segment to first stolen kB 81 ALIGN JUMP_ALIGN 82 .LoopStolenKBs: 83 mov ds, di ; EBDA segment to DS 84 add di, BYTE 64 ; DI to next stolen kB 85 cmp WORD [FULLRAMVARS.wSign], W_SIGN_FULLRAMVARS 86 jne SHORT .LoopStolenKBs ; Loop until sign found (always found eventually) 87 ret 88 89 90 ;-------------------------------------------------------------------- 91 ; Clears RAMVARS variables to zero. 92 ; FULLRAMVARS sign will be saved if available. 93 ; 94 ; RamVars_ClearToZero 45 sub [BDA.wBaseMem], ax 46 mov ax, [BDA.wBaseMem] 47 eSHL_IM ax, 6 ; Segment to first stolen kB (*=40h) 48 mov ds, ax 49 ret 50 51 ;-------------------------------------------------------------------- 52 ; .ClearRamvarsFromDS 95 53 ; Parameters: 96 54 ; DS: RAMVARS segment … … 101 59 ;-------------------------------------------------------------------- 102 60 ALIGN JUMP_ALIGN 103 RamVars_ClearToZero:61 .ClearRamvarsFromDS: 104 62 call FindDPT_PointToFirstDPT ; Get RAMVARS/FULLRAMVARS size to DI 105 63 mov cx, di ; Copy byte count to CX … … 110 68 rep stosb 111 69 mov WORD [FULLRAMVARS.wSign], W_SIGN_FULLRAMVARS 70 ret 71 72 73 ;-------------------------------------------------------------------- 74 ; Returns segment to RAMVARS. 75 ; RAMVARS might be located at the top of interrupt vectors (0030:0000h) 76 ; or at the top of system base RAM. 77 ; 78 ; RamVars_GetSegmentToDS 79 ; Parameters: 80 ; Nothing 81 ; Returns: 82 ; DS: RAMVARS segment 83 ; Corrupts registers: 84 ; DI 85 ;-------------------------------------------------------------------- 86 ALIGN JUMP_ALIGN 87 RamVars_GetSegmentToDS: 88 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE 89 jnz SHORT .GetStolenSegmentToDS 90 mov di, SEGMENT_RAMVARS_TOP_OF_INTERRUPT_VECTORS 91 mov ds, di 92 ret 93 94 ALIGN JUMP_ALIGN 95 .GetStolenSegmentToDS: 96 LOAD_BDA_SEGMENT_TO ds, di 97 mov di, [BDA.wBaseMem] ; Load available base memory size in kB 98 eSHL_IM di, 6 ; Segment to first stolen kB (*=40h) 99 ALIGN JUMP_ALIGN 100 .LoopStolenKBs: 101 mov ds, di ; EBDA segment to DS 102 add di, BYTE 64 ; DI to next stolen kB 103 cmp WORD [FULLRAMVARS.wSign], W_SIGN_FULLRAMVARS 104 jne SHORT .LoopStolenKBs ; Loop until sign found (always found eventually) 112 105 ret 113 106 … … 234 227 and dl, 7Fh ; Clear HD bit for drive count 235 228 ret 229 230 231 ;-------------------------------------------------------------------- 232 ; RamVars_GetIdeControllerCountToCX 233 ; Parameters: 234 ; Nothing 235 ; Returns: 236 ; CX: Number of IDE controllers to handle 237 ; Corrupts registers: 238 ; Nothing 239 ;-------------------------------------------------------------------- 240 ALIGN JUMP_ALIGN 241 RamVars_GetIdeControllerCountToCX: 242 mov cx, 1 ; Assume lite mode (one controller) 243 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE 244 jz SHORT .Return 245 mov cl, [cs:ROMVARS.bIdeCnt] 246 ALIGN JUMP_ALIGN, ret 247 .Return: 248 ret
Note:
See TracChangeset
for help on using the changeset viewer.