[59] | 1 | ; Project name : XTIDE Universal BIOS Configurator v2 |
---|
| 2 | ; Description : "Flash EEPROM" menu structs and functions. |
---|
| 3 | |
---|
[376] | 4 | ; |
---|
[526] | 5 | ; XTIDE Universal BIOS and Associated Tools |
---|
| 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. |
---|
[526] | 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 |
---|
[526] | 16 | ; GNU General Public License for more details. |
---|
[376] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
[526] | 18 | ; |
---|
[376] | 19 | |
---|
[59] | 20 | ; Section containing initialized data |
---|
| 21 | SECTION .data |
---|
| 22 | |
---|
| 23 | ALIGN WORD_ALIGN |
---|
| 24 | g_MenupageForFlashMenu: |
---|
| 25 | istruc MENUPAGE |
---|
| 26 | at MENUPAGE.fnEnter, dw FlashMenu_EnterMenuOrModifyItemVisibility |
---|
| 27 | at MENUPAGE.fnBack, dw MainMenu_EnterMenuOrModifyItemVisibility |
---|
| 28 | at MENUPAGE.wMenuitems, dw 7 |
---|
| 29 | iend |
---|
| 30 | |
---|
| 31 | g_MenuitemFlashBackToMainMenu: |
---|
| 32 | istruc MENUITEM |
---|
| 33 | at MENUITEM.fnActivate, dw MainMenu_EnterMenuOrModifyItemVisibility |
---|
| 34 | at MENUITEM.szName, dw g_szItemCfgBackToMain |
---|
| 35 | at MENUITEM.szQuickInfo, dw g_szItemCfgBackToMain |
---|
| 36 | at MENUITEM.szHelp, dw g_szItemCfgBackToMain |
---|
| 37 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE |
---|
| 38 | at MENUITEM.bType, db TYPE_MENUITEM_PAGEBACK |
---|
| 39 | iend |
---|
| 40 | |
---|
| 41 | g_MenuitemFlashStartFlashing: |
---|
| 42 | istruc MENUITEM |
---|
| 43 | at MENUITEM.fnActivate, dw StartFlashing |
---|
| 44 | at MENUITEM.szName, dw g_szItemFlashStart |
---|
| 45 | at MENUITEM.szQuickInfo, dw g_szNfoFlashStart |
---|
| 46 | at MENUITEM.szHelp, dw g_szNfoFlashStart |
---|
| 47 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE |
---|
| 48 | at MENUITEM.bType, db TYPE_MENUITEM_ACTION |
---|
| 49 | iend |
---|
| 50 | |
---|
| 51 | g_MenuitemFlashEepromType: |
---|
| 52 | istruc MENUITEM |
---|
[108] | 53 | at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI |
---|
[59] | 54 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI |
---|
| 55 | at MENUITEM.szName, dw g_szItemFlashEepromType |
---|
| 56 | at MENUITEM.szQuickInfo, dw g_szNfoFlashEepromType |
---|
| 57 | at MENUITEM.szHelp, dw g_szNfoFlashEepromType |
---|
[620] | 58 | at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_PROGRAMVAR | FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_VISIBLE |
---|
[108] | 59 | at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE |
---|
[59] | 60 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw CFGVARS.bEepromType |
---|
| 61 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgFlashEepromType |
---|
[108] | 62 | at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceEepromType |
---|
| 63 | at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForEepromType |
---|
[59] | 64 | at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForEepromType |
---|
| 65 | iend |
---|
| 66 | |
---|
| 67 | g_MenuitemFlashSdpCommand: |
---|
| 68 | istruc MENUITEM |
---|
[108] | 69 | at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI |
---|
[59] | 70 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI |
---|
| 71 | at MENUITEM.szName, dw g_szItemFlashSDP |
---|
| 72 | at MENUITEM.szQuickInfo, dw g_szNfoFlashSDP |
---|
| 73 | at MENUITEM.szHelp, dw g_szHelpFlashSDP |
---|
[620] | 74 | at MENUITEM.bFlags, db FLG_MENUITEM_PROGRAMVAR | FLG_MENUITEM_BYTEVALUE |
---|
[108] | 75 | at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE |
---|
[59] | 76 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw CFGVARS.bSdpCommand |
---|
| 77 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgFlashSDP |
---|
[108] | 78 | at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceSdpCommand |
---|
| 79 | at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForSdpCommand |
---|
[59] | 80 | at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForSdpCommand |
---|
| 81 | iend |
---|
| 82 | |
---|
| 83 | g_MenuitemFlashPageSize: |
---|
| 84 | istruc MENUITEM |
---|
[108] | 85 | at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI |
---|
[59] | 86 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI |
---|
| 87 | at MENUITEM.szName, dw g_szItemFlashPageSize |
---|
| 88 | at MENUITEM.szQuickInfo, dw g_szNfoFlashPageSize |
---|
| 89 | at MENUITEM.szHelp, dw g_szHelpFlashPageSize |
---|
[620] | 90 | at MENUITEM.bFlags, db FLG_MENUITEM_PROGRAMVAR | FLG_MENUITEM_BYTEVALUE |
---|
[108] | 91 | at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE |
---|
[65] | 92 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw CFGVARS.bEepromPage |
---|
[59] | 93 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgFlashPageSize |
---|
[108] | 94 | at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoicePageSize |
---|
| 95 | at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForPageSize |
---|
[59] | 96 | at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForPageSize |
---|
| 97 | iend |
---|
| 98 | |
---|
| 99 | g_MenuitemFlashEepromAddress: |
---|
| 100 | istruc MENUITEM |
---|
| 101 | at MENUITEM.fnActivate, dw Menuitem_ActivateHexInputForMenuitemInDSSI |
---|
| 102 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI |
---|
| 103 | at MENUITEM.szName, dw g_szItemFlashAddr |
---|
| 104 | at MENUITEM.szQuickInfo, dw g_szNfoFlashAddr |
---|
| 105 | at MENUITEM.szHelp, dw g_szNfoFlashAddr |
---|
| 106 | at MENUITEM.bFlags, db FLG_MENUITEM_PROGRAMVAR | FLG_MENUITEM_VISIBLE |
---|
| 107 | at MENUITEM.bType, db TYPE_MENUITEM_HEX |
---|
| 108 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw CFGVARS.wEepromSegment |
---|
| 109 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgFlashAddr |
---|
| 110 | at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 0C000h |
---|
| 111 | at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 0F800h |
---|
| 112 | iend |
---|
| 113 | |
---|
| 114 | g_MenuitemFlashGenerateChecksum: |
---|
| 115 | istruc MENUITEM |
---|
[108] | 116 | at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI |
---|
[59] | 117 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI |
---|
| 118 | at MENUITEM.szName, dw g_szItemFlashChecksum |
---|
| 119 | at MENUITEM.szQuickInfo, dw g_szNfoFlashChecksum |
---|
| 120 | at MENUITEM.szHelp, dw g_szHelpFlashChecksum |
---|
| 121 | at MENUITEM.bFlags, db FLG_MENUITEM_PROGRAMVAR | FLG_MENUITEM_VISIBLE | FLG_MENUITEM_FLAGVALUE |
---|
[108] | 122 | at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE |
---|
[59] | 123 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw CFGVARS.wFlags |
---|
| 124 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgFlashChecksum |
---|
[108] | 125 | at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag |
---|
[59] | 126 | at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans |
---|
| 127 | at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_CFGVARS_CHECKSUM |
---|
| 128 | iend |
---|
| 129 | |
---|
[108] | 130 | g_rgwChoiceToValueLookupForEepromType: |
---|
[59] | 131 | dw EEPROM_TYPE.2816_2kiB |
---|
| 132 | dw EEPROM_TYPE.2864_8kiB |
---|
[159] | 133 | dw EEPROM_TYPE.2864_8kiB_MOD |
---|
[59] | 134 | dw EEPROM_TYPE.28256_32kiB |
---|
| 135 | dw EEPROM_TYPE.28512_64kiB |
---|
[620] | 136 | dw EEPROM_TYPE.SST_39SF |
---|
| 137 | |
---|
[59] | 138 | g_rgszValueToStringLookupForEepromType: |
---|
| 139 | dw g_szValueFlash2816 |
---|
| 140 | dw g_szValueFlash2864 |
---|
[159] | 141 | dw g_szValueFlash2864Mod |
---|
[59] | 142 | dw g_szValueFlash28256 |
---|
| 143 | dw g_szValueFlash28512 |
---|
[620] | 144 | dw g_szValueFlashSST39SF |
---|
[59] | 145 | |
---|
[108] | 146 | g_rgwChoiceToValueLookupForSdpCommand: |
---|
[59] | 147 | dw SDP_COMMAND.none |
---|
| 148 | dw SDP_COMMAND.enable |
---|
| 149 | dw SDP_COMMAND.disable |
---|
| 150 | g_rgszValueToStringLookupForSdpCommand: |
---|
| 151 | dw g_szValueFlashNone |
---|
| 152 | dw g_szValueFlashEnable |
---|
| 153 | dw g_szValueFlashDisable |
---|
| 154 | |
---|
[108] | 155 | g_rgwChoiceToValueLookupForPageSize: |
---|
[65] | 156 | dw EEPROM_PAGE.1_byte |
---|
| 157 | dw EEPROM_PAGE.2_bytes |
---|
| 158 | dw EEPROM_PAGE.4_bytes |
---|
| 159 | dw EEPROM_PAGE.8_bytes |
---|
| 160 | dw EEPROM_PAGE.16_bytes |
---|
| 161 | dw EEPROM_PAGE.32_bytes |
---|
| 162 | dw EEPROM_PAGE.64_bytes |
---|
[59] | 163 | g_rgszValueToStringLookupForPageSize: |
---|
| 164 | dw g_szValueFlash1byte |
---|
| 165 | dw g_szValueFlash2bytes |
---|
| 166 | dw g_szValueFlash4bytes |
---|
| 167 | dw g_szValueFlash8bytes |
---|
| 168 | dw g_szValueFlash16bytes |
---|
| 169 | dw g_szValueFlash32bytes |
---|
| 170 | dw g_szValueFlash64bytes |
---|
| 171 | |
---|
| 172 | |
---|
| 173 | ; Section containing code |
---|
| 174 | SECTION .text |
---|
| 175 | |
---|
| 176 | ;-------------------------------------------------------------------- |
---|
| 177 | ; MainMenu_EnterMenuOrModifyItemVisibility |
---|
| 178 | ; Parameters: |
---|
| 179 | ; SS:BP: Menu handle |
---|
| 180 | ; Returns: |
---|
| 181 | ; Nothing |
---|
| 182 | ; Corrupts registers: |
---|
| 183 | ; All, except BP |
---|
| 184 | ;-------------------------------------------------------------------- |
---|
| 185 | ALIGN JUMP_ALIGN |
---|
| 186 | FlashMenu_EnterMenuOrModifyItemVisibility: |
---|
| 187 | push cs |
---|
| 188 | pop ds |
---|
[371] | 189 | |
---|
[592] | 190 | cmp WORD [g_cfgVars+CFGVARS.wEepromSegment], 0 |
---|
| 191 | jne SHORT .AlreadySet |
---|
[371] | 192 | |
---|
| 193 | push es |
---|
| 194 | push di |
---|
| 195 | call EEPROM_FindXtideUniversalBiosROMtoESDI |
---|
[592] | 196 | mov ax, es |
---|
[371] | 197 | pop di |
---|
| 198 | pop es |
---|
[592] | 199 | jnc SHORT .StoreEepromSegment |
---|
[371] | 200 | mov ax, DEFAULT_EEPROM_SEGMENT |
---|
[592] | 201 | .StoreEepromSegment: |
---|
| 202 | mov [g_cfgVars+CFGVARS.wEepromSegment], ax |
---|
[526] | 203 | |
---|
[592] | 204 | .AlreadySet: |
---|
[59] | 205 | mov si, g_MenupageForFlashMenu |
---|
[620] | 206 | ePUSH_T bx, Menupage_ChangeToNewMenupageInDSSI |
---|
[621] | 207 | cmp BYTE [g_cfgVars+CFGVARS.bEepromType], EEPROM_TYPE.SST_39SF |
---|
| 208 | mov ax, DisableMenuitemFromCSBX |
---|
| 209 | je SHORT .EnableOrDisableMenuitemsUnusedBySstFlash |
---|
| 210 | mov ax, EnableMenuitemFromCSBX |
---|
| 211 | ; Fall to .EnableOrDisableMenuitemsUnusedBySstFlash |
---|
[59] | 212 | |
---|
[620] | 213 | ;-------------------------------------------------------------------- |
---|
[621] | 214 | ; .EnableOrDisableMenuitemsUnusedBySstFlash |
---|
[620] | 215 | ; Parameters: |
---|
[621] | 216 | ; AX: Offset to EnableMenuitemFromCSBX / DisableMenuitemFromCSBX |
---|
[620] | 217 | ; SS:BP: Menu handle |
---|
| 218 | ; Returns: |
---|
| 219 | ; Nothing |
---|
| 220 | ; Corrupts registers: |
---|
[621] | 221 | ; BX |
---|
[620] | 222 | ;-------------------------------------------------------------------- |
---|
[621] | 223 | .EnableOrDisableMenuitemsUnusedBySstFlash: |
---|
[620] | 224 | mov bx, g_MenuitemFlashSdpCommand |
---|
[621] | 225 | call ax |
---|
[620] | 226 | mov bx, g_MenuitemFlashPageSize |
---|
[621] | 227 | jmp ax |
---|
[59] | 228 | |
---|
| 229 | ;-------------------------------------------------------------------- |
---|
| 230 | ; MENUITEM activation functions (.fnActivate) |
---|
| 231 | ; Parameters: |
---|
| 232 | ; SS:BP: Ptr to MENU |
---|
| 233 | ; Returns: |
---|
| 234 | ; Nothing |
---|
| 235 | ; Corrupts registers: |
---|
| 236 | ; All, except segments |
---|
| 237 | ;-------------------------------------------------------------------- |
---|
| 238 | ALIGN JUMP_ALIGN |
---|
| 239 | StartFlashing: |
---|
[68] | 240 | call .MakeSureThatImageFitsInEeprom |
---|
| 241 | jc SHORT .InvalidFlashingParameters |
---|
[621] | 242 | cmp BYTE [g_cfgVars+CFGVARS.bEepromType], EEPROM_TYPE.SST_39SF |
---|
| 243 | jne SHORT .SkipAlignmentCheck |
---|
[620] | 244 | call .MakeSureAddress32KAligned |
---|
[621] | 245 | jnz SHORT .InvalidFlashingParameters |
---|
[620] | 246 | .SkipAlignmentCheck: |
---|
[65] | 247 | push es |
---|
| 248 | push ds |
---|
| 249 | |
---|
| 250 | call .PrepareBuffersForFlashing |
---|
[602] | 251 | mov cl, FLASHVARS_size + PROGRESS_DIALOG_IO_size |
---|
| 252 | call Memory_ReserveCLbytesFromStackToDSSI |
---|
[65] | 253 | call .InitializeFlashvarsFromDSSI |
---|
| 254 | mov bx, si ; DS:BX now points to FLASHVARS |
---|
[621] | 255 | cmp BYTE [g_cfgVars+CFGVARS.bEepromType], EEPROM_TYPE.SST_39SF |
---|
| 256 | je SHORT .FlashWithoutProgressBar |
---|
[65] | 257 | add si, BYTE FLASHVARS_size ; DS:SI now points to PROGRESS_DIALOG_IO |
---|
| 258 | call Dialogs_DisplayProgressDialogForFlashingWithDialogIoInDSSIandFlashvarsInDSBX |
---|
[620] | 259 | .FlashComplete: |
---|
[65] | 260 | call .DisplayFlashingResultsFromFlashvarsInDSBX |
---|
| 261 | |
---|
| 262 | add sp, BYTE FLASHVARS_size + PROGRESS_DIALOG_IO_size |
---|
| 263 | pop ds |
---|
| 264 | pop es |
---|
[68] | 265 | .InvalidFlashingParameters: |
---|
[59] | 266 | ret |
---|
[65] | 267 | |
---|
[620] | 268 | .FlashWithoutProgressBar: ; Worst case. SST devices will |
---|
| 269 | call FlashSst_WithFlashvarsInDSBX ; either complete flashing |
---|
[621] | 270 | jmp SHORT .FlashComplete ; or timeout within 2 seconds. |
---|
[620] | 271 | |
---|
[65] | 272 | ;-------------------------------------------------------------------- |
---|
[68] | 273 | ; .MakeSureThatImageFitsInEeprom |
---|
| 274 | ; Parameters: |
---|
| 275 | ; SS:BP: Ptr to MENU |
---|
| 276 | ; Returns: |
---|
[118] | 277 | ; CF: Set if EEPROM too small |
---|
[68] | 278 | ; Corrupts registers: |
---|
| 279 | ; AX, BX, DX |
---|
| 280 | ;-------------------------------------------------------------------- |
---|
| 281 | ALIGN JUMP_ALIGN |
---|
| 282 | .MakeSureThatImageFitsInEeprom: |
---|
[620] | 283 | call Buffers_GetSelectedEepromSizeInWordsToAX |
---|
[621] | 284 | cmp ax, [g_cfgVars+CFGVARS.wImageSizeInWords] |
---|
[68] | 285 | jae SHORT .ImageFitsInSelectedEeprom |
---|
| 286 | mov dx, g_szErrEepromTooSmall |
---|
| 287 | call Dialogs_DisplayErrorFromCSDX |
---|
| 288 | stc |
---|
[145] | 289 | ALIGN JUMP_ALIGN, ret |
---|
[68] | 290 | .ImageFitsInSelectedEeprom: |
---|
[620] | 291 | .AlignmentIs32K: |
---|
[592] | 292 | .DoNotGenerateChecksumByte: |
---|
[68] | 293 | ret |
---|
| 294 | |
---|
| 295 | ;-------------------------------------------------------------------- |
---|
[620] | 296 | ; .MakeSureAddress32KAligned |
---|
| 297 | ; Parameters: |
---|
| 298 | ; SS:BP: Ptr to MENU |
---|
| 299 | ; Returns: |
---|
[621] | 300 | ; ZF: Cleared if EEPROM segment is not 32K aligned |
---|
[620] | 301 | ; Corrupts registers: |
---|
[621] | 302 | ; AX, DX |
---|
[620] | 303 | ;-------------------------------------------------------------------- |
---|
| 304 | ALIGN JUMP_ALIGN |
---|
| 305 | .MakeSureAddress32KAligned: |
---|
[621] | 306 | test WORD [g_cfgVars+CFGVARS.wEepromSegment], 07FFh |
---|
[620] | 307 | jz SHORT .AlignmentIs32K |
---|
| 308 | mov dx, g_szErrAddrNot32KAligned |
---|
[621] | 309 | jmp Dialogs_DisplayErrorFromCSDX |
---|
[620] | 310 | |
---|
| 311 | ;-------------------------------------------------------------------- |
---|
[65] | 312 | ; .PrepareBuffersForFlashing |
---|
| 313 | ; Parameters: |
---|
| 314 | ; SS:BP: Ptr to MENU |
---|
| 315 | ; Returns: |
---|
| 316 | ; Nothing |
---|
| 317 | ; Corrupts registers: |
---|
| 318 | ; AX, BX, CX, SI, DI |
---|
| 319 | ;-------------------------------------------------------------------- |
---|
| 320 | ALIGN JUMP_ALIGN |
---|
| 321 | .PrepareBuffersForFlashing: |
---|
| 322 | call EEPROM_LoadFromRomToRamComparisonBuffer |
---|
| 323 | call Buffers_AppendZeroesIfNeeded |
---|
[621] | 324 | test BYTE [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_CHECKSUM |
---|
[65] | 325 | jz SHORT .DoNotGenerateChecksumByte |
---|
| 326 | jmp Buffers_GenerateChecksum |
---|
| 327 | |
---|
| 328 | ;-------------------------------------------------------------------- |
---|
| 329 | ; .InitializeFlashvarsFromDSSI |
---|
| 330 | ; Parameters: |
---|
| 331 | ; DS:SI: Ptr to FLASHVARS to initialize |
---|
| 332 | ; SS:BP: Ptr to MENU |
---|
| 333 | ; Returns: |
---|
| 334 | ; Nothing |
---|
| 335 | ; Corrupts registers: |
---|
| 336 | ; AX, BX, DX, DI, ES |
---|
| 337 | ;-------------------------------------------------------------------- |
---|
| 338 | ALIGN JUMP_ALIGN |
---|
| 339 | .InitializeFlashvarsFromDSSI: |
---|
| 340 | call Buffers_GetFileBufferToESDI |
---|
| 341 | mov [si+FLASHVARS.fpNextSourcePage], di |
---|
| 342 | mov [si+FLASHVARS.fpNextSourcePage+2], es |
---|
| 343 | |
---|
| 344 | call Buffers_GetFlashComparisonBufferToESDI |
---|
| 345 | mov [si+FLASHVARS.fpNextComparisonPage], di |
---|
| 346 | mov [si+FLASHVARS.fpNextComparisonPage+2], es |
---|
| 347 | |
---|
[621] | 348 | mov ax, [g_cfgVars+CFGVARS.wEepromSegment] |
---|
[65] | 349 | mov WORD [si+FLASHVARS.fpNextDestinationPage], 0 |
---|
| 350 | mov [si+FLASHVARS.fpNextDestinationPage+2], ax |
---|
| 351 | |
---|
[621] | 352 | mov al, [g_cfgVars+CFGVARS.bEepromType] |
---|
[65] | 353 | mov [si+FLASHVARS.bEepromType], al |
---|
| 354 | |
---|
[621] | 355 | mov al, [g_cfgVars+CFGVARS.bSdpCommand] |
---|
[65] | 356 | mov [si+FLASHVARS.bEepromSdpCommand], al |
---|
| 357 | |
---|
[620] | 358 | mov ax, SST_PAGE_SIZE |
---|
[621] | 359 | cmp BYTE [g_cfgVars+CFGVARS.bEepromType], EEPROM_TYPE.SST_39SF |
---|
| 360 | je SHORT .UseSstPageSize |
---|
[620] | 361 | |
---|
[621] | 362 | eMOVZX bx, [g_cfgVars+CFGVARS.bEepromPage] |
---|
| 363 | mov ax, [bx+g_rgwEepromPageToSizeInBytes] |
---|
[620] | 364 | .UseSstPageSize: |
---|
[65] | 365 | mov [si+FLASHVARS.wEepromPageSize], ax |
---|
| 366 | |
---|
| 367 | call .GetNumberOfPagesToFlashToAX |
---|
| 368 | mov [si+FLASHVARS.wPagesToFlash], ax |
---|
| 369 | ret |
---|
| 370 | |
---|
| 371 | ;-------------------------------------------------------------------- |
---|
| 372 | ; .GetNumberOfPagesToFlashToAX |
---|
| 373 | ; Parameters: |
---|
| 374 | ; DS:SI: Ptr to FLASHVARS to initialize |
---|
| 375 | ; Returns: |
---|
| 376 | ; AX: Number of pages to flash (0 = 65536) |
---|
| 377 | ; Corrupts registers: |
---|
| 378 | ; BX, DX |
---|
| 379 | ;-------------------------------------------------------------------- |
---|
| 380 | ALIGN JUMP_ALIGN |
---|
| 381 | .GetNumberOfPagesToFlashToAX: |
---|
[620] | 382 | call Buffers_GetSelectedEepromSizeInWordsToAX |
---|
[65] | 383 | xor dx, dx |
---|
[589] | 384 | eSHL_IM ax, 1 ; Size in bytes to... |
---|
| 385 | eRCL_IM dx, 1 ; ...DX:AX |
---|
[65] | 386 | |
---|
| 387 | cmp WORD [si+FLASHVARS.wEepromPageSize], BYTE 1 |
---|
| 388 | jbe SHORT .PreventDivideException |
---|
| 389 | div WORD [si+FLASHVARS.wEepromPageSize] |
---|
| 390 | .PreventDivideException: |
---|
| 391 | ret |
---|
| 392 | |
---|
[68] | 393 | ;-------------------------------------------------------------------- |
---|
[65] | 394 | ; .DisplayFlashingResultsFromFlashvarsInDSBX |
---|
| 395 | ; Parameters: |
---|
| 396 | ; DS:BX: Ptr to FLASHVARS |
---|
| 397 | ; SS:BP: Ptr to MENU |
---|
| 398 | ; Returns: |
---|
| 399 | ; Nothing |
---|
| 400 | ; Corrupts registers: |
---|
| 401 | ; AX, BX, DX |
---|
| 402 | ;-------------------------------------------------------------------- |
---|
| 403 | ALIGN JUMP_ALIGN |
---|
| 404 | .DisplayFlashingResultsFromFlashvarsInDSBX: |
---|
[293] | 405 | eMOVZX bx, [bx+FLASHVARS.flashResult] |
---|
[65] | 406 | jmp [cs:bx+.rgfnFlashResultMessage] |
---|
| 407 | |
---|
| 408 | ALIGN WORD_ALIGN |
---|
| 409 | .rgfnFlashResultMessage: |
---|
| 410 | dw .DisplayFlashSuccessful |
---|
[620] | 411 | dw .DisplayDeviceDetectionError |
---|
[65] | 412 | dw .DisplayPollingError |
---|
| 413 | dw .DisplayDataVerifyError |
---|
| 414 | |
---|
| 415 | |
---|
| 416 | ;-------------------------------------------------------------------- |
---|
[620] | 417 | ; .DisplayDeviceDetectionError |
---|
[65] | 418 | ; .DisplayPollingError |
---|
| 419 | ; .DisplayDataVerifyError |
---|
| 420 | ; .DisplayFlashSuccessful |
---|
| 421 | ; Parameters: |
---|
| 422 | ; SS:BP: Ptr to MENU |
---|
| 423 | ; Returns: |
---|
| 424 | ; Nothing |
---|
| 425 | ; Corrupts registers: |
---|
| 426 | ; AX, DX, DI, ES |
---|
| 427 | ;-------------------------------------------------------------------- |
---|
| 428 | ALIGN JUMP_ALIGN |
---|
[620] | 429 | .DisplayDeviceDetectionError: |
---|
| 430 | mov dx, g_szErrEepromDetection |
---|
| 431 | jmp Dialogs_DisplayErrorFromCSDX |
---|
| 432 | |
---|
| 433 | ALIGN JUMP_ALIGN |
---|
[65] | 434 | .DisplayPollingError: |
---|
| 435 | mov dx, g_szErrEepromPolling |
---|
| 436 | jmp Dialogs_DisplayErrorFromCSDX |
---|
| 437 | |
---|
| 438 | ALIGN JUMP_ALIGN |
---|
| 439 | .DisplayDataVerifyError: |
---|
| 440 | mov dx, g_szErrEepromVerify |
---|
| 441 | jmp Dialogs_DisplayErrorFromCSDX |
---|
| 442 | |
---|
| 443 | ALIGN JUMP_ALIGN |
---|
| 444 | .DisplayFlashSuccessful: |
---|
| 445 | call Buffers_GetFileBufferToESDI |
---|
| 446 | cmp WORD [es:di+ROMVARS.wRomSign], 0AA55h ; PC ROM? |
---|
| 447 | je SHORT .DisplayRebootMessageAndReboot |
---|
| 448 | mov dx, g_szForeignFlash |
---|
| 449 | jmp Dialogs_DisplayNotificationFromCSDX |
---|
| 450 | ALIGN JUMP_ALIGN |
---|
| 451 | .DisplayRebootMessageAndReboot: |
---|
[293] | 452 | mov dx, g_szPCFlashSuccessful |
---|
[65] | 453 | call Dialogs_DisplayNotificationFromCSDX |
---|
[246] | 454 | xor ax, ax ; Cold boot flag |
---|
| 455 | jmp Reboot_ComputerWithBootFlagInAX |
---|