| 1 |
|
|---|
| 2 | ; Disclaimer:
|
|---|
| 3 | ;=============
|
|---|
| 4 | ; The sourcecode is released via www.netlabs.org CVS *ONLY*.
|
|---|
| 5 | ; You MUST NOT upload it to other servers nor republish it in any way.
|
|---|
| 6 | ; The sourcecode is still COPYRIGHTED and NOT YET RELEASED UNDER GPL.
|
|---|
| 7 | ; It's (c) Copyright 1998-2002 by Martin Kiewitz.
|
|---|
| 8 | ; You may recompile the source and do *PRIVATE* modifications, but please keep
|
|---|
| 9 | ; in mind that modifying this code needs at least *some* assembly skill. If
|
|---|
| 10 | ; you mess up your system, because you needed to hack your way through, don't
|
|---|
| 11 | ; blame me. Releasing a customized version of AiR-BOOT, selling it in any form
|
|---|
| 12 | ; or reusing parts of this source is *PROHIBITED*. Ask me, if you have some
|
|---|
| 13 | ; idea about new functionality *before* developing the code, otherwise I will
|
|---|
| 14 | ; definitely reject it. Also please accept, that I have some basic design
|
|---|
| 15 | ; rules on AiR-BOOT and I will maintain them at all costs, so this won't get
|
|---|
| 16 | ; another GRUB.
|
|---|
| 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
|
|---|
| 27 | GetLenOfName 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
|
|---|
| 40 | GetLenOfName 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
|
|---|
| 46 | GetLenOfString 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
|
|---|
| 58 | GetLenOfString 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
|
|---|
| 64 | GetLenOfStrings 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
|
|---|
| 76 | GetLenOfStrings EndP
|
|---|
| 77 |
|
|---|
| 78 | PRECRAP_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 | ; Setup PartitionPointers-Table
|
|---|
| 93 | call PART_CalculateStraightPartPointers
|
|---|
| 94 |
|
|---|
| 95 | ; Setup Cyrillic Charset, if needed
|
|---|
| 96 | ifdef TXT_IncludeCyrillic
|
|---|
| 97 | call CHARSET_IncludeCyrillic
|
|---|
| 98 | endif
|
|---|
| 99 |
|
|---|
| 100 | call PRECRAP_CheckFor13extensions
|
|---|
| 101 | IFNDEF ReleaseCode
|
|---|
| 102 | ret
|
|---|
| 103 | ENDIF
|
|---|
| 104 | call PRECRAP_CheckConfiguration
|
|---|
| 105 | ; =======================================
|
|---|
| 106 | ; Checks for MBR Virii :) I love that job
|
|---|
| 107 | ; =======================================
|
|---|
| 108 | test CFG_DetectStealth, 1
|
|---|
| 109 | jz PCM_NoStealthDetection
|
|---|
| 110 | call VIRUS_CheckForStealth
|
|---|
| 111 | PCM_NoStealthDetection:
|
|---|
| 112 | test CFG_DetectVirus, 1
|
|---|
| 113 | jz PCM_NoVirusDetection
|
|---|
| 114 | call VIRUS_CheckForVirus
|
|---|
| 115 | PCM_NoVirusDetection:
|
|---|
| 116 | ; ============================================
|
|---|
| 117 | ; Delay for some time and get Strg/Alt State
|
|---|
| 118 | ; ============================================
|
|---|
| 119 | test CFG_CooperBars, 1
|
|---|
| 120 | jnz PCM_ShortDelay
|
|---|
| 121 | mov al, 27 ; About 1.5 seconds
|
|---|
| 122 | test CFG_FloppyBootGetName, 1
|
|---|
| 123 | jz PCM_LongDelay
|
|---|
| 124 | PCM_ShortDelay:
|
|---|
| 125 | mov al, 13 ; shorten delay,if floppy gets accessed
|
|---|
| 126 | PCM_LongDelay:
|
|---|
| 127 | call TIMER_WaitTicCount
|
|---|
| 128 | ; First check, if any normal key got pressed...
|
|---|
| 129 | mov ah, 1
|
|---|
| 130 | int 16h
|
|---|
| 131 | jz PCM_NoNormalKeyPressed
|
|---|
| 132 | ; User doesn't know what to do...or he is crazy <g> so display message
|
|---|
| 133 | mov si, offset TXT_HowEnterSetup
|
|---|
| 134 | call MBR_Teletype
|
|---|
| 135 | mov al, 54 ; about 3 seconds, delay again
|
|---|
| 136 | call TIMER_WaitTicCount
|
|---|
| 137 | PCM_NoNormalKeyPressed:
|
|---|
| 138 | ; Now get keyboard Strg/Alt State
|
|---|
| 139 | mov ah, 02h
|
|---|
| 140 | int 16h
|
|---|
| 141 | mov SETUP_KeysOnEntry, al
|
|---|
| 142 | ret
|
|---|
| 143 | PRECRAP_Main EndP
|
|---|
| 144 |
|
|---|
| 145 | AFTERCRAP_Main Proc Near Uses
|
|---|
| 146 | ; ===================================================
|
|---|
| 147 | ; Now get volume label of FloppyDrive, if wanted...
|
|---|
| 148 | ; ===================================================
|
|---|
| 149 | test CFG_FloppyBootGetName, 1
|
|---|
| 150 | jz ACM_NoFloppyGetName
|
|---|
| 151 | call DriveIO_UpdateFloppyName
|
|---|
| 152 | or ax, ax
|
|---|
| 153 | jnz ACM_NoFloppyGetName
|
|---|
| 154 | ; Try a second time, if it failed to detect the Floppy
|
|---|
| 155 | call DriveIO_UpdateFloppyName
|
|---|
| 156 | ACM_NoFloppyGetName:
|
|---|
| 157 | ret
|
|---|
| 158 | AFTERCRAP_Main EndP
|
|---|
| 159 |
|
|---|
| 160 | PRECRAP_CheckFor13extensions Proc Near
|
|---|
| 161 | mov ah, 41h
|
|---|
| 162 | mov bx, 55AAh
|
|---|
| 163 | mov dl, 80h
|
|---|
| 164 | int 13h
|
|---|
| 165 | cmp bx, 0AA55h
|
|---|
| 166 | je PCCF13E_Found
|
|---|
| 167 | PCCF13E_NotFound:
|
|---|
| 168 | ret
|
|---|
| 169 | PCCF13E_Found:
|
|---|
| 170 | and cx, 1
|
|---|
| 171 | jz PCCF13E_NotFound
|
|---|
| 172 | mov CurIO_UseExtension, 1
|
|---|
| 173 | ret
|
|---|
| 174 | PRECRAP_CheckFor13extensions EndP
|
|---|
| 175 |
|
|---|
| 176 | ; Checks Configuration CheckSum...Displays message, if failed.
|
|---|
| 177 | PRECRAP_CheckConfiguration Proc Near Uses ds si es di
|
|---|
| 178 | mov si, offset Configuration
|
|---|
| 179 | xor bx, bx
|
|---|
| 180 | mov cx, 5 ; Total of 5 Sectors
|
|---|
| 181 | mov dx, CFG_CheckConfig
|
|---|
| 182 | mov CFG_CheckConfig, bx
|
|---|
| 183 | PCCC_Loop:
|
|---|
| 184 | call MBR_GetCheckOfSector
|
|---|
| 185 | loop PCCC_Loop
|
|---|
| 186 | cmp bx, dx
|
|---|
| 187 | jne PCCC_Failed
|
|---|
| 188 | mov CFG_CheckConfig, dx
|
|---|
| 189 | ret
|
|---|
| 190 | PCCC_Failed:
|
|---|
| 191 | mov si, offset TXT_ERROR_CheckConfig
|
|---|
| 192 | call MBR_Teletype
|
|---|
| 193 | mov si, offset TXT_ERROR_CheckFailed
|
|---|
| 194 | call MBR_Teletype
|
|---|
| 195 | jmp MBR_HaltSystem
|
|---|
| 196 | PRECRAP_CheckConfiguration EndP
|
|---|