source: trunk/BOOTCODE/REGULAR/OTHER.ASM@ 29

Last change on this file since 29 was 29, checked in by Ben Rietbroek, 15 years ago

AiR-BOOT v1.06 -- Complete sourceforge mirror. (r56) [2010-02-19]
Signature-date: 2006-03-13.
Also contains binairy releases from v1.01 to v1.06, cd-rom images, etc.
If you want the whole pre v1.07 shebang, checkout this revision's trunk.
The v1.06 reference version is in 'tags/v1.06r'.
Note that this reference version uses 'NL' for 'Dutch'.

File size: 6.5 KB
Line 
1; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
2;
3; This file is part of AiR-BOOT
4;
5; AiR-BOOT is free software: you can redistribute it and/or modify it under
6; the terms of the GNU General Public License as published by the Free
7; Software Foundation, either version 3 of the License, or (at your option)
8; any later version.
9;
10; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
11; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
12; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13; details.
14;
15; You should have received a copy of the GNU General Public License along with
16; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
17;
18;---------------------------------------------------------------------------
19; AiR-BOOT / OTHER ROUTINES
20;---------------------------------------------------------------------------
21
22; In: DS:SI - Pointer to begin of string
23; CX - Len of string
24; Out: CX - Supposed real len of string
25; Zero Flag set if nul string
26; Destroyed: None
27GetLenOfName Proc Near Uses ax si
28 add si, cx
29 dec si
30 GLON_NameLoop:
31 mov al, ds:[si]
32 dec si
33 cmp al, 32
34 ja GLON_EndLoop
35 dec cx
36 jnz GLON_NameLoop
37 GLON_EndLoop:
38 or cx, cx
39 ret ; return supposed len
40GetLenOfName EndP
41
42; In: DS:SI - Pointer to NUL-terminated string
43; Out: CX - Length of string
44; Zero Flag set if nul string
45; Destroyed: None
46GetLenOfString Proc Near Uses ax si
47 xor cx, cx
48 GLOS_StringLoop:
49 lodsb
50 or al, al
51 jz GLOS_EndOfString
52 inc cx
53 jmp GLOS_StringLoop
54
55 GLOS_EndOfString:
56 or cx, cx
57 ret
58GetLenOfString EndP
59
60; In: DS:SI - Pointer to NUL-terminated strings
61; CL - Counter, how many strings to count
62; Out: CX - Length of strings
63; Destroyed: None
64GetLenOfStrings Proc Near Uses bx dx si
65 mov dh, cl
66 xor dl, dl
67 GLOSS_StringsLoop:
68 call GetLenOfString
69 add dl, cl
70 add si, cx
71 inc si
72 dec dh
73 jnz GLOSS_StringsLoop
74 movzx cx, dl
75 ret
76GetLenOfStrings EndP
77
78PRECRAP_Main Proc Near Uses
79 ; First initialize Variable-Area (everything with NUL)
80 mov di, offset BeginOfVariables
81 mov cx, offset EndOfVariables-offset BeginOfVariables
82 xor ax, ax
83 shr cx, 1
84 inc cx
85 rep stosw
86
87 mov VideoIO_Segment, VideoIO_Page0
88
89 ; Calculate Cooper-Bar Tables
90 call FX_CalculateTables
91
92 ; Calculate LVM-CRC-Table
93 call LVM_InitCRCTable
94
95 ; Get HardDriveCount
96 call DriveIO_GetHardDriveCount
97
98 ; Calculate CHS/LBA Switch Table
99 call DriveIO_InitLBASwitchTable
100
101 ; Setup PartitionPointers-Table
102 call PART_CalculateStraightPartPointers
103
104 ; Setup Cyrillic Charset, if needed
105 ifdef TXT_IncludeCyrillic
106 call CHARSET_IncludeCyrillic
107 endif
108
109 call PRECRAP_CheckFor13extensions
110 IFNDEF ReleaseCode
111 ret
112 ENDIF
113 call PRECRAP_CheckConfiguration
114 ; =======================================
115 ; Checks for MBR Virii :) I love that job
116 ; =======================================
117 test CFG_DetectStealth, 1
118 jz PCM_NoStealthDetection
119 call VIRUS_CheckForStealth
120 PCM_NoStealthDetection:
121 test CFG_DetectVirus, 1
122 jz PCM_NoVirusDetection
123 call VIRUS_CheckForVirus
124 PCM_NoVirusDetection:
125 ; ============================================
126 ; Delay for some time and get Strg/Alt State
127 ; ============================================
128 test CFG_CooperBars, 1
129 jnz PCM_ShortDelay
130 mov al, 27 ; About 1.5 seconds
131 test CFG_FloppyBootGetName, 1
132 jz PCM_LongDelay
133 PCM_ShortDelay:
134 mov al, 13 ; shorten delay,if floppy gets accessed
135 PCM_LongDelay:
136 call TIMER_WaitTicCount
137 ; First check, if any normal key got pressed...
138 mov ah, 1
139 int 16h
140 jz PCM_NoNormalKeyPressed
141 ; User doesn't know what to do...or he is crazy <g> so display message
142 mov si, offset TXT_HowEnterSetup
143 call MBR_Teletype
144 mov al, 54 ; about 3 seconds, delay again
145 call TIMER_WaitTicCount
146 PCM_NoNormalKeyPressed:
147 ; Now get keyboard Strg/Alt State
148 mov ah, 02h
149 int 16h
150 mov SETUP_KeysOnEntry, al
151
152 ; Copy device-name to the ContBIOSbootSeq-IPT entry
153 ; We may not do this before PRECRAP_CheckConfiguration, because otherwise
154 ; this check will fail.
155 call PART_UpdateResumeBIOSName
156 ret
157PRECRAP_Main EndP
158
159AFTERCRAP_Main Proc Near Uses
160 ; ===================================================
161 ; Now get volume label of FloppyDrive, if wanted...
162 ; ===================================================
163 test CFG_FloppyBootGetName, 1
164 jz ACM_NoFloppyGetName
165 call DriveIO_UpdateFloppyName
166 or ax, ax
167 jnz ACM_NoFloppyGetName
168 ; Try a second time, if it failed to detect the Floppy
169 call DriveIO_UpdateFloppyName
170 ACM_NoFloppyGetName:
171 ret
172AFTERCRAP_Main EndP
173
174PRECRAP_CheckFor13extensions Proc Near
175 mov ah, 41h
176 mov bx, 55AAh
177 mov dl, 80h
178 int 13h
179 cmp bx, 0AA55h
180 je PCCF13E_Found
181 PCCF13E_NotFound:
182 ret
183 PCCF13E_Found:
184 and cx, 1
185 jz PCCF13E_NotFound
186 mov CurIO_UseExtension, 1
187 ret
188PRECRAP_CheckFor13extensions EndP
189
190; Checks Configuration CheckSum...Displays message, if failed.
191PRECRAP_CheckConfiguration Proc Near Uses ds si es di
192 mov si, offset Configuration
193 xor bx, bx
194 mov cx, 5 ; Total of 5 Sectors
195 mov dx, CFG_CheckConfig
196 mov CFG_CheckConfig, bx
197 PCCC_Loop:
198 call MBR_GetCheckOfSector
199 loop PCCC_Loop
200 cmp bx, dx
201 jne PCCC_Failed
202 mov CFG_CheckConfig, dx
203 ret
204 PCCC_Failed:
205 mov si, offset TXT_ERROR_CheckConfig
206 call MBR_Teletype
207 mov si, offset TXT_ERROR_CheckFailed
208 call MBR_Teletype
209 jmp MBR_HaltSystem
210PRECRAP_CheckConfiguration EndP
Note: See TracBrowser for help on using the repository browser.